@@ -126,6 +126,8 @@ def test_set_running_workflow_done_when_success():
126
126
response = utaa .get_running_workflow (running_workflow_id = rwfid )
127
127
assert response ["running_workflow" ]["done" ]
128
128
assert response ["running_workflow" ]["success" ]
129
+ assert response ["running_workflow" ]["error" ] is None
130
+ assert response ["running_workflow" ]["error_msg" ] is None
129
131
130
132
131
133
def test_set_running_workflow_done_when_failed ():
@@ -141,12 +143,16 @@ def test_set_running_workflow_done_when_failed():
141
143
rwfid = response ["id" ]
142
144
143
145
# Act
144
- utaa .set_running_workflow_done (running_workflow_id = rwfid , success = False )
146
+ utaa .set_running_workflow_done (
147
+ running_workflow_id = rwfid , success = False , error = 1 , error_msg = "Bang!"
148
+ )
145
149
146
150
# Assert
147
151
response = utaa .get_running_workflow (running_workflow_id = rwfid )
148
152
assert response ["running_workflow" ]["done" ]
149
153
assert not response ["running_workflow" ]["success" ]
154
+ assert response ["running_workflow" ]["error" ] == 1
155
+ assert response ["running_workflow" ]["error_msg" ] == "Bang!"
150
156
151
157
152
158
def test_create_running_workflow_step ():
@@ -169,6 +175,60 @@ def test_create_running_workflow_step():
169
175
assert response ["id" ] == "r-workflow-step-00000000-0000-0000-0000-000000000001"
170
176
171
177
178
+ def test_set_running_workflow_step_done_when_success ():
179
+ # Arrange
180
+ utaa = UnitTestAPIAdapter ()
181
+ response = utaa .create_workflow (workflow_definition = {"name" : "blah" })
182
+ response = utaa .create_running_workflow (
183
+ user_id = "dlister" ,
184
+ workflow_id = response ["id" ],
185
+ project_id = TEST_PROJECT_ID ,
186
+ variables = {},
187
+ )
188
+ response = utaa .create_running_workflow_step (
189
+ running_workflow_id = response ["id" ], step = "step-1"
190
+ )
191
+ rwfsid = response ["id" ]
192
+
193
+ # Act
194
+ utaa .set_running_workflow_step_done (running_workflow_step_id = rwfsid , success = True )
195
+
196
+ # Assert
197
+ response = utaa .get_running_workflow_step (running_workflow_step_id = rwfsid )
198
+ assert response ["running_workflow_step" ]["done" ]
199
+ assert response ["running_workflow_step" ]["success" ]
200
+ assert response ["running_workflow_step" ]["error" ] is None
201
+ assert response ["running_workflow_step" ]["error_msg" ] is None
202
+
203
+
204
+ def test_set_running_workflow_step_done_when_failed ():
205
+ # Arrange
206
+ utaa = UnitTestAPIAdapter ()
207
+ response = utaa .create_workflow (workflow_definition = {"name" : "blah" })
208
+ response = utaa .create_running_workflow (
209
+ user_id = "dlister" ,
210
+ workflow_id = response ["id" ],
211
+ project_id = TEST_PROJECT_ID ,
212
+ variables = {},
213
+ )
214
+ response = utaa .create_running_workflow_step (
215
+ running_workflow_id = response ["id" ], step = "step-1"
216
+ )
217
+ rwfsid = response ["id" ]
218
+
219
+ # Act
220
+ utaa .set_running_workflow_step_done (
221
+ running_workflow_step_id = rwfsid , success = False , error = 1 , error_msg = "Bang!"
222
+ )
223
+
224
+ # Assert
225
+ response = utaa .get_running_workflow_step (running_workflow_step_id = rwfsid )
226
+ assert response ["running_workflow_step" ]["done" ]
227
+ assert not response ["running_workflow_step" ]["success" ]
228
+ assert response ["running_workflow_step" ]["error" ] == 1
229
+ assert response ["running_workflow_step" ]["error_msg" ] == "Bang!"
230
+
231
+
172
232
def test_get_running_workflow_step ():
173
233
# Arrange
174
234
utaa = UnitTestAPIAdapter ()
0 commit comments