Skip to content

Commit af938c5

Browse files
samyarpotlapallismlindauer
authored andcommitted
Adding proper return value for successfu; get_definition call
1 parent c705539 commit af938c5

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

tests/unit/test_score_execution.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_create_score_execution():
3434
- Valid execution id?
3535
3636
-Valid count key? -> treated like input mapping -> no because i think it's required
37-
- output table -> treat like input mapping but within the create_score_execution step (do I for library and server in score definition thought?)
37+
- 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)
3838
3939
"""
4040
with mock.patch("sasctl.core.Session._get_authorization_token"):
@@ -44,8 +44,8 @@ def test_create_score_execution():
4444
"sasctl._services.score_definitions.ScoreDefinitions.get_definition"
4545
) as get_definition:
4646
with mock.patch(
47-
"sasctl._services.score_execution.ScoreExecution.get_execution"
48-
) as get_execution:
47+
"sasctl._services.score_execution.ScoreExecution.list_executions"
48+
) as list_executions:
4949
with mock.patch(
5050
"sasctl._services.score_execution.ScoreExecution.delete_execution"
5151
) as delete_execution:
@@ -58,12 +58,33 @@ def test_create_score_execution():
5858
score_definition_id="12345",
5959
)
6060
get_definition.return_value.status_code = 200
61-
get_execution.return_value.status_code = 400 #we might need a separate try except here to show that 404 statement is weird and should exit the program
61+
get_definition.return_value.json.return_value = {
62+
"inputData": {
63+
"libraryName": "cas-shared-default",
64+
"tableName": ""
65+
},
66+
"name": "publish_automated_1720400011_2024-07-08T00:54:41.859Z",
67+
"objectDescriptor": {
68+
"name": "test_model",
69+
"type": "sas.publish.example",
70+
"uri": "/modelPublish/models/example"
71+
}
72+
}
73+
list_executions.return_value.status_code = 400 #we might need a separate try except here to show that 404 statement is weird and should exit the program
6274
with pytest.raises(HTTPError):
6375
se.create_score_execution(
6476
score_definition_id="12345",
6577
)
66-
#stdout or pytest.raises but without ending program?
78+
79+
list_executions.return_value.status_code = 200
80+
list_executions.return_value.json.return_value = {
81+
"count": 1
82+
}
83+
delete_execution.return_value.status_code = 2
84+
85+
6786

6887
#pytest.skip()
6988
# raise HTTP error?
89+
#notes -> how to test count because it should only delete if count == 1 so how do I test that if/else
90+
#notes -> output table case, again TARGET?

0 commit comments

Comments
 (0)