Skip to content

Commit b23ab79

Browse files
authored
Merge pull request #638 from watson-developer-cloud/release
Release 2.8.0
2 parents f92a715 + f4b5440 commit b23ab79

16 files changed

+725
-443
lines changed

test/unit/test_discovery_v1.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,12 @@ def test_stopword_operations():
12291229
responses.DELETE,
12301230
url,
12311231
status=200)
1232+
responses.add(
1233+
responses.GET,
1234+
url,
1235+
body='{"status": "ready", "type": "stopwords"}',
1236+
status=200,
1237+
content_type='application_json')
12321238

12331239
discovery = watson_developer_cloud.DiscoveryV1('2017-11-07', username="username", password="password")
12341240

@@ -1237,10 +1243,13 @@ def test_stopword_operations():
12371243
discovery.create_stopword_list('envid', 'colid', file)
12381244
assert responses.calls[0].response.json() == {"status": "pending", "type": "stopwords"}
12391245

1246+
discovery.get_stopword_list_status('envid', 'colid')
1247+
assert responses.calls[1].response.json() == {"status": "ready", "type": "stopwords"}
1248+
12401249
discovery.delete_stopword_list('envid', 'colid')
1241-
assert responses.calls[1].response.status_code == 200
1250+
assert responses.calls[2].response.status_code == 200
12421251

1243-
assert len(responses.calls) == 2
1252+
assert len(responses.calls) == 3
12441253

12451254
@responses.activate
12461255
def test_gateway_configuration():

test/unit/test_speech_to_text_v1.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,29 @@ def test_acoustic_model():
297297

298298
assert len(responses.calls) == 6
299299

300+
@responses.activate
301+
def test_upgrade_acoustic_model():
302+
acoustic_customization_url = 'https://stream.watsonplatform.net/speech-to-text/api/v1/acoustic_customizations'
303+
upgrade_url = "{0}/{1}/upgrade_model".format(acoustic_customization_url, 'customid')
304+
305+
responses.add(
306+
responses.POST,
307+
upgrade_url,
308+
body='{"bogus_response": "yep"}',
309+
status=200,
310+
content_type='application/json')
311+
312+
speech_to_text = watson_developer_cloud.SpeechToTextV1(
313+
username="username", password="password")
314+
315+
speech_to_text.upgrade_acoustic_model(
316+
'customid',
317+
'model_x',
318+
force=True)
319+
assert responses.calls[0].response.json() == {"bogus_response": "yep"}
320+
321+
assert len(responses.calls) == 1
322+
300323

301324
def test_custom_corpora():
302325

test/unit/test_watson_service.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,17 @@ def test_for_icp():
170170
assert service2.password is not None
171171
assert service2.url is 'service_url'
172172

173+
service3 = AnyServiceV1('2017-07-07', iam_apikey='icp-xxx')
174+
assert service3.token_manager is None
175+
assert service2.iam_apikey is None
176+
assert service2.username is not None
177+
assert service2.password is not None
178+
179+
service4 = AnyServiceV1('2017-07-07', iam_access_token='lala')
180+
assert service4.token_manager is not None
181+
assert service4.username is None
182+
assert service4.password is None
183+
173184
@responses.activate
174185
def test_disable_SSL_verification():
175186
service1 = AnyServiceV1('2017-07-07', username='apikey', password='icp-xxxx', url='service_url')

0 commit comments

Comments
 (0)