test(assistantv2): Update assistantv2 tests
import json
import responses
import ibm_watson
+from ibm_cloud_sdk_core.authenticators import BasicAuthenticator
platform_url = 'https://gateway.watsonplatform.net'
service_path = '/assistant/api'
@@ -18,8 +19,9 @@ def test_create_session():
body=json.dumps(response),
status=200,
content_type='application/json')
+ authenticator = BasicAuthenticator('username', 'password')
service = ibm_watson.AssistantV2(
- username='username', password='password', version='2017-02-03')
+ version='2017-02-03', authenticator=authenticator)
session = service.create_session('bogus_id').get_result()
assert len(responses.calls) == 1
assert responses.calls[0].request.url.startswith(url)
@@ -38,8 +40,9 @@ def test_delete_session():
body=json.dumps(response),
status=200,
content_type='application/json')
+ authenticator = BasicAuthenticator('username', 'password')
service = ibm_watson.AssistantV2(
- username='username', password='password', version='2017-02-03')
+ version='2017-02-03', authenticator=authenticator)
delete_session = service.delete_session('bogus_id',
'session_id').get_result()
assert len(responses.calls) == 1
@@ -73,8 +76,9 @@ def test_message():
body=json.dumps(response),
status=200,
content_type='application/json')
+ authenticator = BasicAuthenticator('username', 'password')
service = ibm_watson.AssistantV2(
- username='username', password='password', version='2017-02-03')
+ version='2017-02-03', authenticator=authenticator)
message = service.message(
'bogus_id', 'session_id', input={
'text': 'What\'s the weather like?'
