Skip to content

Commit

Permalink
test(assistantv2): Update assistantv2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ehdsouza committed Aug 28, 2019
1 parent 1e2d48f commit f94e5d5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/unit/test_assistant_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
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'
Expand All @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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?'
Expand Down

0 comments on commit f94e5d5

Please sign in to comment.