@@ -66,23 +66,21 @@ def test_create_score_definition():
66
66
"sasctl._services.score_definitions.ScoreDefinitions.post"
67
67
) as post :
68
68
# Invalid model id test case
69
- get_model .return_value = None
69
+ get_model .side_effect = HTTPError ( "No Model Found" )
70
70
with pytest .raises (HTTPError ):
71
71
sd .create_score_definition (
72
72
score_def_name = "test_create_sd" ,
73
73
model = "12345" ,
74
74
table_name = "test_table" ,
75
75
)
76
-
76
+ get_model . side_effect = None
77
77
# Valid model id but invalid table name with no table_file argument test case
78
- get_model_mock = CustomMock (
79
- json_info = {
80
- "id" : "12345" ,
81
- "projectId" : "54321" ,
82
- "projectVersionId" : "67890" ,
83
- "name" : "test_model" ,
84
- },
85
- )
78
+ get_model_mock = {
79
+ "id" : "12345" ,
80
+ "projectId" : "54321" ,
81
+ "projectVersionId" : "67890" ,
82
+ "name" : "test_model" ,
83
+ }
86
84
get_model .return_value = get_model_mock
87
85
get_table .return_value = None
88
86
with pytest .raises (HTTPError ):
@@ -107,9 +105,7 @@ def test_create_score_definition():
107
105
# Valid table_file argument that successfully creates a table test case
108
106
get_table .return_value = None
109
107
upload_file .return_value = RestObj
110
- get_table_mock = CustomMock (
111
- json_info = {"tableName" : "test_table" },
112
- )
108
+ get_table_mock = {"tableName" : "test_table" }
113
109
get_table .return_value = get_table_mock
114
110
response = sd .create_score_definition (
115
111
score_def_name = "test_create_sd" ,
@@ -130,19 +126,17 @@ def test_create_score_definition():
130
126
assert response
131
127
132
128
# Checking response with inputVariables in model elements
133
- get_model_mock = CustomMock (
134
- json_info = {
135
- "id" : "12345" ,
136
- "projectId" : "54321" ,
137
- "projectVersionId" : "67890" ,
138
- "name" : "test_model" ,
139
- "inputVariables" : [
140
- {"name" : "first" },
141
- {"name" : "second" },
142
- {"name" : "third" },
143
- ],
144
- },
145
- )
129
+ get_model_mock = {
130
+ "id" : "12345" ,
131
+ "projectId" : "54321" ,
132
+ "projectVersionId" : "67890" ,
133
+ "name" : "test_model" ,
134
+ "inputVariables" : [
135
+ {"name" : "first" },
136
+ {"name" : "second" },
137
+ {"name" : "third" },
138
+ ],
139
+ }
146
140
get_model .return_value = get_model_mock
147
141
get_table .return_value = get_table_mock
148
142
response = sd .create_score_definition (
0 commit comments