Skip to content

Commit 41a3a51

Browse files
committed
test(service name): Mullti word service name
1 parent 7981d92 commit 41a3a51

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

resources/ibm-credentials-iam.env

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
WATSON_APIKEY=5678efgh
2-
WATSON_AUTH_TYPE=iam
3-
WATSON_URL=https://gateway-s.watsonplatform.net/watson/api
4-
WATSON_DISABLE_SSL=False
1+
IBM-WATSON_APIKEY=5678efgh
2+
IBM-WATSON_AUTH_TYPE=iam
3+
IBM-WATSON_URL=https://gateway-s.watsonplatform.net/watson/api
4+
IBM-WATSON_DISABLE_SSL=False

test/test_base_service.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from ibm_cloud_sdk_core import ApiException
1010
from ibm_cloud_sdk_core import CP4DTokenManager
1111
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator, NoAuthAuthenticator, Authenticator, BasicAuthenticator, CloudPakForDataAuthenticator
12+
from ibm_cloud_sdk_core import get_authenticator_from_environment
1213

1314

1415
class AnyServiceV1(BaseService):
@@ -24,7 +25,7 @@ def __init__(self,
2425
service_url=service_url,
2526
authenticator=authenticator,
2627
disable_ssl_verification=disable_ssl_verification,
27-
display_name='Watson')
28+
display_name='ibm Watson')
2829
self.version = version
2930

3031
def op_with_path_params(self, path0, path1):
@@ -135,10 +136,10 @@ def test_fail_http_config():
135136

136137
@responses.activate
137138
def test_iam():
138-
iam_authenticator = IAMAuthenticator('my_apikey', 'https://iam-test.cloud.ibm.com/identity/token')
139139
file_path = os.path.join(
140140
os.path.dirname(__file__), '../resources/ibm-credentials-iam.env')
141141
os.environ['IBM_CREDENTIALS_FILE'] = file_path
142+
iam_authenticator = get_authenticator_from_environment('ibm-watson')
142143
service = AnyServiceV1('2017-07-07', authenticator=iam_authenticator)
143144
assert service.service_url == 'https://gateway.watsonplatform.net/test/api'
144145
del os.environ['IBM_CREDENTIALS_FILE']
@@ -153,7 +154,7 @@ def test_iam():
153154
}
154155
responses.add(
155156
responses.POST,
156-
url='https://iam-test.cloud.ibm.com/identity/token',
157+
url='https://iam.cloud.ibm.com/identity/token',
157158
body=json.dumps(response),
158159
status=200)
159160
responses.add(

test/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_get_authenticator_from_credential_file():
1111
file_path = os.path.join(
1212
os.path.dirname(__file__), '../resources/ibm-credentials-iam.env')
1313
os.environ['IBM_CREDENTIALS_FILE'] = file_path
14-
authenticator = get_authenticator_from_environment('watson')
14+
authenticator = get_authenticator_from_environment('ibm watson')
1515
assert authenticator is not None
1616
assert authenticator.token_manager.apikey == '5678efgh'
1717
del os.environ['IBM_CREDENTIALS_FILE']

0 commit comments

Comments
 (0)