@@ -66,23 +66,21 @@ def test_create_score_definition():
6666 "sasctl._services.score_definitions.ScoreDefinitions.post"
6767 ) as post :
6868 # Invalid model id test case
69- get_model .return_value = None
69+ get_model .side_effect = HTTPError ( "No Model Found" )
7070 with pytest .raises (HTTPError ):
7171 sd .create_score_definition (
7272 score_def_name = "test_create_sd" ,
7373 model = "12345" ,
7474 table_name = "test_table" ,
7575 )
76-
76+ get_model . side_effect = None
7777 # 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+ }
8684 get_model .return_value = get_model_mock
8785 get_table .return_value = None
8886 with pytest .raises (HTTPError ):
@@ -107,9 +105,7 @@ def test_create_score_definition():
107105 # Valid table_file argument that successfully creates a table test case
108106 get_table .return_value = None
109107 upload_file .return_value = RestObj
110- get_table_mock = CustomMock (
111- json_info = {"tableName" : "test_table" },
112- )
108+ get_table_mock = {"tableName" : "test_table" }
113109 get_table .return_value = get_table_mock
114110 response = sd .create_score_definition (
115111 score_def_name = "test_create_sd" ,
@@ -130,19 +126,17 @@ def test_create_score_definition():
130126 assert response
131127
132128 # 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+ }
146140 get_model .return_value = get_model_mock
147141 get_table .return_value = get_table_mock
148142 response = sd .create_score_definition (
0 commit comments