Skip to content

Commit c121953

Browse files
committed
test(all): Update all unit tests
1 parent da15f4d commit c121953

14 files changed

+351
-24
lines changed

test/unit/test_assistant_v1.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# (C) Copyright IBM Corp. 2018, 2020.
2+
# (C) Copyright IBM Corp. 2020.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -277,14 +277,15 @@ def construct_full_body(self):
277277
"system_settings":
278278
WorkspaceSystemSettings._from_dict(
279279
json.loads(
280-
"""{"tooling": {"store_generic_responses": false}, "disambiguation": {"prompt": "fake_prompt", "none_of_the_above_prompt": "fake_none_of_the_above_prompt", "enabled": false, "sensitivity": "fake_sensitivity", "randomize": false, "max_suggestions": 15, "suggestion_text_policy": "fake_suggestion_text_policy"}, "off_topic": {"enabled": false}}"""
280+
"""{"tooling": {"store_generic_responses": false}, "disambiguation": {"prompt": "fake_prompt", "none_of_the_above_prompt": "fake_none_of_the_above_prompt", "enabled": false, "sensitivity": "fake_sensitivity", "randomize": false, "max_suggestions": 15, "suggestion_text_policy": "fake_suggestion_text_policy"}, "system_entities": {"enabled": false}, "off_topic": {"enabled": false}}"""
281281
)),
282282
"intents": [],
283283
"entities": [],
284284
"dialog_nodes": [],
285285
"counterexamples": [],
286286
"webhooks": [],
287287
})
288+
body['include_audit'] = True
288289
return body
289290

290291
def construct_required_body(self):
@@ -442,7 +443,7 @@ def construct_full_body(self):
442443
"system_settings":
443444
WorkspaceSystemSettings._from_dict(
444445
json.loads(
445-
"""{"tooling": {"store_generic_responses": false}, "disambiguation": {"prompt": "fake_prompt", "none_of_the_above_prompt": "fake_none_of_the_above_prompt", "enabled": false, "sensitivity": "fake_sensitivity", "randomize": false, "max_suggestions": 15, "suggestion_text_policy": "fake_suggestion_text_policy"}, "off_topic": {"enabled": false}}"""
446+
"""{"tooling": {"store_generic_responses": false}, "disambiguation": {"prompt": "fake_prompt", "none_of_the_above_prompt": "fake_none_of_the_above_prompt", "enabled": false, "sensitivity": "fake_sensitivity", "randomize": false, "max_suggestions": 15, "suggestion_text_policy": "fake_suggestion_text_policy"}, "system_entities": {"enabled": false}, "off_topic": {"enabled": false}}"""
446447
)),
447448
"intents": [],
448449
"entities": [],
@@ -451,6 +452,7 @@ def construct_full_body(self):
451452
"webhooks": [],
452453
})
453454
body['append'] = True
455+
body['include_audit'] = True
454456
return body
455457

456458
def construct_required_body(self):
@@ -682,6 +684,7 @@ def construct_full_body(self):
682684
"description": "string1",
683685
"examples": [],
684686
})
687+
body['include_audit'] = True
685688
return body
686689

687690
def construct_required_body(self):
@@ -839,6 +842,8 @@ def construct_full_body(self):
839842
"new_description": "string1",
840843
"new_examples": [],
841844
})
845+
body['append'] = True
846+
body['include_audit'] = True
842847
return body
843848

844849
def construct_required_body(self):
@@ -1082,6 +1087,7 @@ def construct_full_body(self):
10821087
"text": "string1",
10831088
"mentions": [],
10841089
})
1090+
body['include_audit'] = True
10851091
return body
10861092

10871093
def construct_required_body(self):
@@ -1240,6 +1246,7 @@ def construct_full_body(self):
12401246
"new_text": "string1",
12411247
"new_mentions": [],
12421248
})
1249+
body['include_audit'] = True
12431250
return body
12441251

12451252
def construct_required_body(self):
@@ -1482,6 +1489,7 @@ def construct_full_body(self):
14821489
body.update({
14831490
"text": "string1",
14841491
})
1492+
body['include_audit'] = True
14851493
return body
14861494

14871495
def construct_required_body(self):
@@ -1634,6 +1642,7 @@ def construct_full_body(self):
16341642
body.update({
16351643
"new_text": "string1",
16361644
})
1645+
body['include_audit'] = True
16371646
return body
16381647

16391648
def construct_required_body(self):
@@ -1876,6 +1885,7 @@ def construct_full_body(self):
18761885
"fuzzy_match": True,
18771886
"values": [],
18781887
})
1888+
body['include_audit'] = True
18791889
return body
18801890

18811891
def construct_required_body(self):
@@ -2041,6 +2051,8 @@ def construct_full_body(self):
20412051
"new_fuzzy_match": True,
20422052
"new_values": [],
20432053
})
2054+
body['append'] = True
2055+
body['include_audit'] = True
20442056
return body
20452057

20462058
def construct_required_body(self):
@@ -2381,6 +2393,7 @@ def construct_full_body(self):
23812393
"synonyms": [],
23822394
"patterns": [],
23832395
})
2396+
body['include_audit'] = True
23842397
return body
23852398

23862399
def construct_required_body(self):
@@ -2550,6 +2563,8 @@ def construct_full_body(self):
25502563
"new_synonyms": [],
25512564
"new_patterns": [],
25522565
})
2566+
body['append'] = True
2567+
body['include_audit'] = True
25532568
return body
25542569

25552570
def construct_required_body(self):
@@ -2802,6 +2817,7 @@ def construct_full_body(self):
28022817
body.update({
28032818
"synonym": "string1",
28042819
})
2820+
body['include_audit'] = True
28052821
return body
28062822

28072823
def construct_required_body(self):
@@ -2964,6 +2980,7 @@ def construct_full_body(self):
29642980
body.update({
29652981
"new_synonym": "string1",
29662982
})
2983+
body['include_audit'] = True
29672984
return body
29682985

29692986
def construct_required_body(self):
@@ -3253,6 +3270,7 @@ def construct_full_body(self):
32533270
"disambiguation_opt_out":
32543271
True,
32553272
})
3273+
body['include_audit'] = True
32563274
return body
32573275

32583276
def construct_required_body(self):
@@ -3493,6 +3511,7 @@ def construct_full_body(self):
34933511
"new_disambiguation_opt_out":
34943512
True,
34953513
})
3514+
body['include_audit'] = True
34963515
return body
34973516

34983517
def construct_required_body(self):
@@ -3937,9 +3956,9 @@ def send_request(obj, body, response, url=None):
39373956
fake_response__json = None
39383957
fake_response_MessageResponse_json = """{"input": {"text": "fake_text"}, "intents": [], "entities": [], "alternate_intents": false, "context": {"conversation_id": "fake_conversation_id", "system": {}, "metadata": {"deployment": "fake_deployment", "user_id": "fake_user_id"}}, "output": {"nodes_visited": [], "nodes_visited_details": [], "log_messages": [], "text": [], "generic": []}, "actions": []}"""
39393958
fake_response_WorkspaceCollection_json = """{"workspaces": [], "pagination": {"refresh_url": "fake_refresh_url", "next_url": "fake_next_url", "total": 5, "matched": 7, "refresh_cursor": "fake_refresh_cursor", "next_cursor": "fake_next_cursor"}}"""
3940-
fake_response_Workspace_json = """{"name": "fake_name", "description": "fake_description", "language": "fake_language", "learning_opt_out": true, "system_settings": {"tooling": {"store_generic_responses": false}, "disambiguation": {"prompt": "fake_prompt", "none_of_the_above_prompt": "fake_none_of_the_above_prompt", "enabled": false, "sensitivity": "fake_sensitivity", "randomize": false, "max_suggestions": 15, "suggestion_text_policy": "fake_suggestion_text_policy"}, "off_topic": {"enabled": false}}, "workspace_id": "fake_workspace_id", "status": "fake_status", "created": "2017-05-16T13:56:54.957Z", "updated": "2017-05-16T13:56:54.957Z", "intents": [], "entities": [], "dialog_nodes": [], "counterexamples": [], "webhooks": []}"""
3941-
fake_response_Workspace_json = """{"name": "fake_name", "description": "fake_description", "language": "fake_language", "learning_opt_out": true, "system_settings": {"tooling": {"store_generic_responses": false}, "disambiguation": {"prompt": "fake_prompt", "none_of_the_above_prompt": "fake_none_of_the_above_prompt", "enabled": false, "sensitivity": "fake_sensitivity", "randomize": false, "max_suggestions": 15, "suggestion_text_policy": "fake_suggestion_text_policy"}, "off_topic": {"enabled": false}}, "workspace_id": "fake_workspace_id", "status": "fake_status", "created": "2017-05-16T13:56:54.957Z", "updated": "2017-05-16T13:56:54.957Z", "intents": [], "entities": [], "dialog_nodes": [], "counterexamples": [], "webhooks": []}"""
3942-
fake_response_Workspace_json = """{"name": "fake_name", "description": "fake_description", "language": "fake_language", "learning_opt_out": true, "system_settings": {"tooling": {"store_generic_responses": false}, "disambiguation": {"prompt": "fake_prompt", "none_of_the_above_prompt": "fake_none_of_the_above_prompt", "enabled": false, "sensitivity": "fake_sensitivity", "randomize": false, "max_suggestions": 15, "suggestion_text_policy": "fake_suggestion_text_policy"}, "off_topic": {"enabled": false}}, "workspace_id": "fake_workspace_id", "status": "fake_status", "created": "2017-05-16T13:56:54.957Z", "updated": "2017-05-16T13:56:54.957Z", "intents": [], "entities": [], "dialog_nodes": [], "counterexamples": [], "webhooks": []}"""
3959+
fake_response_Workspace_json = """{"name": "fake_name", "description": "fake_description", "language": "fake_language", "learning_opt_out": true, "system_settings": {"tooling": {"store_generic_responses": false}, "disambiguation": {"prompt": "fake_prompt", "none_of_the_above_prompt": "fake_none_of_the_above_prompt", "enabled": false, "sensitivity": "fake_sensitivity", "randomize": false, "max_suggestions": 15, "suggestion_text_policy": "fake_suggestion_text_policy"}, "system_entities": {"enabled": false}, "off_topic": {"enabled": false}}, "workspace_id": "fake_workspace_id", "status": "fake_status", "created": "2017-05-16T13:56:54.957Z", "updated": "2017-05-16T13:56:54.957Z", "intents": [], "entities": [], "dialog_nodes": [], "counterexamples": [], "webhooks": []}"""
3960+
fake_response_Workspace_json = """{"name": "fake_name", "description": "fake_description", "language": "fake_language", "learning_opt_out": true, "system_settings": {"tooling": {"store_generic_responses": false}, "disambiguation": {"prompt": "fake_prompt", "none_of_the_above_prompt": "fake_none_of_the_above_prompt", "enabled": false, "sensitivity": "fake_sensitivity", "randomize": false, "max_suggestions": 15, "suggestion_text_policy": "fake_suggestion_text_policy"}, "system_entities": {"enabled": false}, "off_topic": {"enabled": false}}, "workspace_id": "fake_workspace_id", "status": "fake_status", "created": "2017-05-16T13:56:54.957Z", "updated": "2017-05-16T13:56:54.957Z", "intents": [], "entities": [], "dialog_nodes": [], "counterexamples": [], "webhooks": []}"""
3961+
fake_response_Workspace_json = """{"name": "fake_name", "description": "fake_description", "language": "fake_language", "learning_opt_out": true, "system_settings": {"tooling": {"store_generic_responses": false}, "disambiguation": {"prompt": "fake_prompt", "none_of_the_above_prompt": "fake_none_of_the_above_prompt", "enabled": false, "sensitivity": "fake_sensitivity", "randomize": false, "max_suggestions": 15, "suggestion_text_policy": "fake_suggestion_text_policy"}, "system_entities": {"enabled": false}, "off_topic": {"enabled": false}}, "workspace_id": "fake_workspace_id", "status": "fake_status", "created": "2017-05-16T13:56:54.957Z", "updated": "2017-05-16T13:56:54.957Z", "intents": [], "entities": [], "dialog_nodes": [], "counterexamples": [], "webhooks": []}"""
39433962
fake_response_IntentCollection_json = """{"intents": [], "pagination": {"refresh_url": "fake_refresh_url", "next_url": "fake_next_url", "total": 5, "matched": 7, "refresh_cursor": "fake_refresh_cursor", "next_cursor": "fake_next_cursor"}}"""
39443963
fake_response_Intent_json = """{"intent": "fake_intent", "description": "fake_description", "created": "2017-05-16T13:56:54.957Z", "updated": "2017-05-16T13:56:54.957Z", "examples": []}"""
39453964
fake_response_Intent_json = """{"intent": "fake_intent", "description": "fake_description", "created": "2017-05-16T13:56:54.957Z", "updated": "2017-05-16T13:56:54.957Z", "examples": []}"""

test/unit/test_assistant_v2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# (C) Copyright IBM Corp. 2018, 2020.
2+
# (C) Copyright IBM Corp. 2020.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -256,7 +256,7 @@ def construct_full_body(self):
256256
"context":
257257
MessageContext._from_dict(
258258
json.loads(
259-
"""{"global": {"system": {"timezone": "fake_timezone", "user_id": "fake_user_id", "turn_count": 10}}, "skills": {}}"""
259+
"""{"global": {"system": {"timezone": "fake_timezone", "user_id": "fake_user_id", "turn_count": 10, "locale": "fake_locale", "reference_time": "fake_reference_time"}}, "skills": {}}"""
260260
)),
261261
})
262262
return body
@@ -343,4 +343,4 @@ def send_request(obj, body, response, url=None):
343343

344344
fake_response__json = None
345345
fake_response_SessionResponse_json = """{"session_id": "fake_session_id"}"""
346-
fake_response_MessageResponse_json = """{"output": {"generic": [], "intents": [], "entities": [], "actions": [], "debug": {"nodes_visited": [], "log_messages": [], "branch_exited": false, "branch_exited_reason": "fake_branch_exited_reason"}}, "context": {"global": {"system": {"timezone": "fake_timezone", "user_id": "fake_user_id", "turn_count": 10}}, "skills": {}}}"""
346+
fake_response_MessageResponse_json = """{"output": {"generic": [], "intents": [], "entities": [], "actions": [], "debug": {"nodes_visited": [], "log_messages": [], "branch_exited": false, "branch_exited_reason": "fake_branch_exited_reason"}}, "context": {"global": {"system": {"timezone": "fake_timezone", "user_id": "fake_user_id", "turn_count": 10, "locale": "fake_locale", "reference_time": "fake_reference_time"}}, "skills": {}}}"""

test/unit/test_compare_comply_v1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# (C) Copyright IBM Corp. 2018, 2020.
2+
# (C) Copyright IBM Corp. 2020.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

test/unit/test_discovery_v1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# (C) Copyright IBM Corp. 2016, 2020.
2+
# (C) Copyright IBM Corp. 2020.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

test/unit/test_discovery_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# (C) Copyright IBM Corp. 2019, 2020.
2+
# (C) Copyright IBM Corp. 2020.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

test/unit/test_language_translator_v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# (C) Copyright IBM Corp. 2018, 2020.
2+
# (C) Copyright IBM Corp. 2020.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

test/unit/test_natural_language_classifier_v1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# (C) Copyright IBM Corp. 2015, 2020.
2+
# (C) Copyright IBM Corp. 2020.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

test/unit/test_natural_language_understanding_v1.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import json
2020
import pytest
2121
import responses
22-
import tempfile
2322
import ibm_watson.natural_language_understanding_v1
2423
from ibm_watson.natural_language_understanding_v1 import *
2524

@@ -96,7 +95,7 @@ def construct_full_body(self):
9695
"features":
9796
Features._from_dict(
9897
json.loads(
99-
"""{"concepts": {"limit": 5}, "emotion": {"document": true, "targets": []}, "entities": {"limit": 5, "mentions": true, "model": "fake_model", "sentiment": false, "emotion": false}, "keywords": {"limit": 5, "sentiment": false, "emotion": false}, "metadata": {}, "relations": {"model": "fake_model"}, "semantic_roles": {"limit": 5, "keywords": true, "entities": true}, "sentiment": {"document": true, "targets": []}, "categories": {"explanation": false, "limit": 5}, "syntax": {"tokens": {"lemma": false, "part_of_speech": true}, "sentences": false}}"""
98+
"""{"concepts": {"limit": 5}, "emotion": {"document": true, "targets": []}, "entities": {"limit": 5, "mentions": true, "model": "fake_model", "sentiment": false, "emotion": false}, "keywords": {"limit": 5, "sentiment": false, "emotion": false}, "metadata": {}, "relations": {"model": "fake_model"}, "semantic_roles": {"limit": 5, "keywords": true, "entities": true}, "sentiment": {"document": true, "targets": []}, "categories": {"explanation": false, "limit": 5, "model": "fake_model"}, "syntax": {"tokens": {"lemma": false, "part_of_speech": true}, "sentences": false}}"""
10099
)),
101100
"text":
102101
"string1",
@@ -125,7 +124,7 @@ def construct_required_body(self):
125124
"features":
126125
Features._from_dict(
127126
json.loads(
128-
"""{"concepts": {"limit": 5}, "emotion": {"document": true, "targets": []}, "entities": {"limit": 5, "mentions": true, "model": "fake_model", "sentiment": false, "emotion": false}, "keywords": {"limit": 5, "sentiment": false, "emotion": false}, "metadata": {}, "relations": {"model": "fake_model"}, "semantic_roles": {"limit": 5, "keywords": true, "entities": true}, "sentiment": {"document": true, "targets": []}, "categories": {"explanation": false, "limit": 5}, "syntax": {"tokens": {"lemma": false, "part_of_speech": true}, "sentences": false}}"""
127+
"""{"concepts": {"limit": 5}, "emotion": {"document": true, "targets": []}, "entities": {"limit": 5, "mentions": true, "model": "fake_model", "sentiment": false, "emotion": false}, "keywords": {"limit": 5, "sentiment": false, "emotion": false}, "metadata": {}, "relations": {"model": "fake_model"}, "semantic_roles": {"limit": 5, "keywords": true, "entities": true}, "sentiment": {"document": true, "targets": []}, "categories": {"explanation": false, "limit": 5, "model": "fake_model"}, "syntax": {"tokens": {"lemma": false, "part_of_speech": true}, "sentences": false}}"""
129128
)),
130129
"text":
131130
"string1",

test/unit/test_personality_insights_v3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# (C) Copyright IBM Corp. 2018, 2020.
2+
# (C) Copyright IBM Corp. 2020.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

test/unit/test_speech_to_text_v1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# (C) Copyright IBM Corp. 2015, 2020.
2+
# (C) Copyright IBM Corp. 2020.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)