You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Creating a CustomMock for list_executions to avoid a TypeError when comparing status code from mock with >= 400 in score_execution
31
+
classCustomMock:
32
+
def__init__(self, status_code, json_info):
33
+
self.status_code=status_code
34
+
self.json_info=json_info
35
+
36
+
defget(self, key1, key2=None, key3=None):
37
+
ifkey2isNoneandkey3isNone:
38
+
returnself.json_info[key1]
39
+
else:
40
+
returnself.json_info[key1][key2][key3]
41
+
42
+
29
43
deftest_create_score_execution():
30
44
"""
31
45
Test Cases:
32
-
- Valid score definition id?
33
-
-yes
34
-
-no
35
-
- Valid execution id?
36
-
37
-
-Valid count key? -> treated like input mapping -> no because i think it's required
38
-
- output table -> treat like input mapping but within the create_score_execution step (do I for library and server in score definition thought? but I think you need a target step here too)
46
+
- Valid score definition id and invalid list_executions argument
47
+
- Invalid score definition id
48
+
- Valid list_executions argument with execution already running but invalid delete_execution argument
49
+
- Valid list_executions argument with execution already running but valid delete_execution argument
50
+
- Valid list_executions argument without execution already running
51
+
- With output table specified within create_score_execution arguments
39
52
40
53
"""
54
+
55
+
# Mocking a session to allow the post call to go through
# Valid score definition id and invalid list_executions argument test case
61
82
get_definition.return_value.status_code=200
62
83
get_definition.return_value.json.return_value= {
63
84
"inputData": {
64
85
"libraryName": "cas-shared-default",
65
-
"tableName": ""
86
+
"tableName": "test_table",
66
87
},
67
88
"name": "score_def_name",
68
89
"objectDescriptor": {
69
90
"name": "test_model",
70
91
"type": "sas.publish.example",
71
-
"uri": "/modelPublish/models/example"
72
-
}
92
+
"uri": "/modelPublish/models/example",
93
+
},
73
94
}
74
-
list_executions.return_value.status_code=400#test case worked with .return_value.status_code but caused an HTTP error that said error with list_Executions
list_executions.status_code=200#why does this not have a return value and how is this related to different score_Defintion instantiation in score_execution
0 commit comments