ibm-cloud-sdk-core 3.16.0__py3-none-any.whl → 3.21.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ibm_cloud_sdk_core/__init__.py +1 -0
- ibm_cloud_sdk_core/api_exception.py +18 -4
- ibm_cloud_sdk_core/authenticators/__init__.py +1 -0
- ibm_cloud_sdk_core/authenticators/authenticator.py +2 -1
- ibm_cloud_sdk_core/authenticators/basic_authenticator.py +12 -7
- ibm_cloud_sdk_core/authenticators/bearer_token_authenticator.py +7 -2
- ibm_cloud_sdk_core/authenticators/container_authenticator.py +25 -16
- ibm_cloud_sdk_core/authenticators/cp4d_authenticator.py +38 -23
- ibm_cloud_sdk_core/authenticators/iam_authenticator.py +22 -13
- ibm_cloud_sdk_core/authenticators/iam_request_based_authenticator.py +10 -8
- ibm_cloud_sdk_core/authenticators/mcsp_authenticator.py +134 -0
- ibm_cloud_sdk_core/authenticators/vpc_instance_authenticator.py +12 -11
- ibm_cloud_sdk_core/base_service.py +137 -103
- ibm_cloud_sdk_core/detailed_response.py +21 -15
- ibm_cloud_sdk_core/get_authenticator.py +35 -17
- ibm_cloud_sdk_core/http_adapter.py +28 -0
- ibm_cloud_sdk_core/logger.py +85 -0
- ibm_cloud_sdk_core/private_helpers.py +34 -0
- ibm_cloud_sdk_core/token_managers/container_token_manager.py +63 -33
- ibm_cloud_sdk_core/token_managers/cp4d_token_manager.py +35 -22
- ibm_cloud_sdk_core/token_managers/iam_request_based_token_manager.py +50 -21
- ibm_cloud_sdk_core/token_managers/iam_token_manager.py +24 -13
- ibm_cloud_sdk_core/token_managers/jwt_token_manager.py +3 -16
- ibm_cloud_sdk_core/token_managers/mcsp_token_manager.py +108 -0
- ibm_cloud_sdk_core/token_managers/token_manager.py +20 -23
- ibm_cloud_sdk_core/token_managers/vpc_instance_token_manager.py +37 -18
- ibm_cloud_sdk_core/utils.py +127 -48
- ibm_cloud_sdk_core/version.py +1 -1
- ibm_cloud_sdk_core-3.21.0.dist-info/METADATA +159 -0
- ibm_cloud_sdk_core-3.21.0.dist-info/RECORD +35 -0
- {ibm_cloud_sdk_core-3.16.0.dist-info → ibm_cloud_sdk_core-3.21.0.dist-info}/WHEEL +1 -1
- ibm_cloud_sdk_core-3.21.0.dist-info/top_level.txt +1 -0
- ibm_cloud_sdk_core-3.16.0.dist-info/METADATA +0 -112
- ibm_cloud_sdk_core-3.16.0.dist-info/RECORD +0 -52
- ibm_cloud_sdk_core-3.16.0.dist-info/top_level.txt +0 -3
- ibm_cloud_sdk_core-3.16.0.dist-info/zip-safe +0 -1
- test/__init__.py +0 -0
- test/test_api_exception.py +0 -73
- test/test_authenticator.py +0 -21
- test/test_base_service.py +0 -933
- test/test_basic_authenticator.py +0 -36
- test/test_bearer_authenticator.py +0 -28
- test/test_container_authenticator.py +0 -105
- test/test_container_token_manager.py +0 -283
- test/test_cp4d_authenticator.py +0 -171
- test/test_cp4d_token_manager.py +0 -56
- test/test_detailed_response.py +0 -57
- test/test_iam_authenticator.py +0 -157
- test/test_iam_token_manager.py +0 -362
- test/test_jwt_token_manager.py +0 -109
- test/test_no_auth_authenticator.py +0 -15
- test/test_token_manager.py +0 -84
- test/test_utils.py +0 -634
- test/test_vpc_instance_authenticator.py +0 -66
- test/test_vpc_instance_token_manager.py +0 -266
- test_integration/__init__.py +0 -0
- test_integration/test_cp4d_authenticator_integration.py +0 -45
- {ibm_cloud_sdk_core-3.16.0.dist-info → ibm_cloud_sdk_core-3.21.0.dist-info}/LICENSE +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
test/__init__.py
DELETED
|
File without changes
|
test/test_api_exception.py
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
import json
|
|
3
|
-
|
|
4
|
-
import requests
|
|
5
|
-
import responses
|
|
6
|
-
|
|
7
|
-
from ibm_cloud_sdk_core import ApiException
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@responses.activate
|
|
11
|
-
def test_api_exception():
|
|
12
|
-
"""Test APIException class"""
|
|
13
|
-
responses.add(responses.GET,
|
|
14
|
-
'https://test.com',
|
|
15
|
-
status=500,
|
|
16
|
-
body=json.dumps({'error': 'sorry', 'msg': 'serious error'}),
|
|
17
|
-
content_type='application/json')
|
|
18
|
-
|
|
19
|
-
mock_response = requests.get('https://test.com')
|
|
20
|
-
exception = ApiException(500, http_response=mock_response)
|
|
21
|
-
assert exception is not None
|
|
22
|
-
assert exception.message == 'sorry'
|
|
23
|
-
|
|
24
|
-
responses.add(responses.GET,
|
|
25
|
-
'https://test-again.com',
|
|
26
|
-
status=500,
|
|
27
|
-
body=json.dumps({
|
|
28
|
-
"errors": [
|
|
29
|
-
{
|
|
30
|
-
"message": "sorry again",
|
|
31
|
-
}],
|
|
32
|
-
}),
|
|
33
|
-
content_type='application/json')
|
|
34
|
-
mock_response = requests.get('https://test-again.com')
|
|
35
|
-
exception = ApiException(500, http_response=mock_response)
|
|
36
|
-
assert exception.message == 'sorry again'
|
|
37
|
-
|
|
38
|
-
responses.add(responses.GET,
|
|
39
|
-
'https://test-once-more.com',
|
|
40
|
-
status=500,
|
|
41
|
-
body=json.dumps({'message': 'sorry once more'}),
|
|
42
|
-
content_type='application/json')
|
|
43
|
-
mock_response = requests.get('https://test-once-more.com')
|
|
44
|
-
exception = ApiException(500, http_response=mock_response)
|
|
45
|
-
assert exception.message == 'sorry once more'
|
|
46
|
-
|
|
47
|
-
responses.add(responses.GET,
|
|
48
|
-
'https://test-msg.com',
|
|
49
|
-
status=500,
|
|
50
|
-
body=json.dumps({'msg': 'serious error'}),
|
|
51
|
-
content_type='application/json')
|
|
52
|
-
mock_response = requests.get('https://test-msg.com')
|
|
53
|
-
exception = ApiException(500, http_response=mock_response)
|
|
54
|
-
assert exception.message == 'Internal Server Error'
|
|
55
|
-
|
|
56
|
-
responses.add(responses.GET,
|
|
57
|
-
'https://test-errormessage.com',
|
|
58
|
-
status=500,
|
|
59
|
-
body=json.dumps({'errorMessage': 'IAM error message'}),
|
|
60
|
-
content_type='application/json')
|
|
61
|
-
mock_response = requests.get('https://test-errormessage.com')
|
|
62
|
-
exception = ApiException(500, http_response=mock_response)
|
|
63
|
-
assert exception.message == 'IAM error message'
|
|
64
|
-
|
|
65
|
-
responses.add(responses.GET,
|
|
66
|
-
'https://test-for-text.com',
|
|
67
|
-
status=500,
|
|
68
|
-
headers={'X-Global-Transaction-ID': 'xx'},
|
|
69
|
-
body="plain text error")
|
|
70
|
-
mock_response = requests.get('https://test-for-text.com')
|
|
71
|
-
exception = ApiException(500, http_response=mock_response)
|
|
72
|
-
assert exception.message == 'plain text error'
|
|
73
|
-
assert str(exception) == 'Error: plain text error, Code: 500 , X-global-transaction-id: xx'
|
test/test_authenticator.py
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# pylint: disable=missing-docstring
|
|
3
|
-
|
|
4
|
-
from requests import Request
|
|
5
|
-
from ibm_cloud_sdk_core.authenticators import Authenticator
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class TestAuthenticator(Authenticator):
|
|
9
|
-
"""A test of the Authenticator base class"""
|
|
10
|
-
|
|
11
|
-
def validate(self) -> None:
|
|
12
|
-
"""Simulated validate() method."""
|
|
13
|
-
|
|
14
|
-
def authenticate(self, req: Request) -> None:
|
|
15
|
-
"""Simulated authenticate() method."""
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def test_authenticator():
|
|
19
|
-
authenticator = TestAuthenticator()
|
|
20
|
-
assert authenticator is not None
|
|
21
|
-
assert authenticator.authentication_type() == Authenticator.AUTHTYPE_UNKNOWN
|