Skip to content

Commit

Permalink
fix(client props): Setting of the external client config happens in i…
Browse files Browse the repository at this point in the history
…ndividual services
  • Loading branch information
ehdsouza committed Sep 18, 2019
1 parent 50fad59 commit 4148034
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
9 changes: 0 additions & 9 deletions ibm_cloud_sdk_core/base_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,6 @@ def __init__(self,
raise ValueError(
'authenticator should be of type Authenticator')

if display_name:
service_name = display_name.replace(' ', '_').replace('-', '_').lower()
config = read_external_sources(service_name)
if config.get('url'):
self.service_url = config.get('url')
if config.get('disable_ssl'):
self.disable_ssl_verification = config.get('disable_ssl')


def _get_system_info(self):
return '{0} {1} {2}'.format(
platform.system(), # OS
Expand Down
9 changes: 2 additions & 7 deletions test/test_base_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def test_iam():
os.path.dirname(__file__), '../resources/ibm-credentials-iam.env')
os.environ['IBM_CREDENTIALS_FILE'] = file_path
service = AnyServiceV1('2017-07-07', authenticator=iam_authenticator)
assert service.service_url == 'https://gateway-s.watsonplatform.net/watson/api'
assert service.service_url == 'https://gateway.watsonplatform.net/test/api'
del os.environ['IBM_CREDENTIALS_FILE']
assert service.authenticator is not None

Expand All @@ -158,7 +158,7 @@ def test_iam():
status=200)
responses.add(
responses.GET,
url='https://gateway-s.watsonplatform.net/watson/api',
url='https://gateway.watsonplatform.net/test/api',
body=json.dumps({
"foobar": "baz"
}),
Expand Down Expand Up @@ -422,8 +422,3 @@ def test_service_url_not_set():
with pytest.raises(ValueError) as err:
service.prepare_request('POST', url='')
assert str(err.value) == 'The service_url is required'

def test_multi_word_service_name():
os.environ['personality-insights_url'] = 'xyz'
service = BaseService(service_url='', authenticator=NoAuthAuthenticator(), display_name='personality-insights')
assert service.service_url == 'xyz'

0 comments on commit 4148034

Please sign in to comment.