@@ -324,9 +324,20 @@ def test_get_running_workflow_step_with_prior_step():
324324def test_create_instance ():
325325 # Arrange
326326 utaa = UnitTestWorkflowAPIAdapter ()
327+ response = utaa .create_workflow (workflow_definition = {"name" : "blah" })
328+ response = utaa .create_running_workflow (
329+ user_id = "dlister" ,
330+ workflow_id = response ["id" ],
331+ project_id = TEST_PROJECT_ID ,
332+ variables = {},
333+ )
334+ response , _ = utaa .create_running_workflow_step (
335+ running_workflow_id = response ["id" ], step = "step-1"
336+ )
337+ rwfs_id = response ["id" ]
327338
328339 # Act
329- response = utaa .create_instance (running_workflow_step_id = "r-workflow-step-000" )
340+ response = utaa .create_instance (running_workflow_step_id = rwfs_id )
330341
331342 # Assert
332343 assert "id" in response
@@ -335,14 +346,79 @@ def test_create_instance():
335346def test_create_and_get_instance ():
336347 # Arrange
337348 utaa = UnitTestWorkflowAPIAdapter ()
338- response = utaa .create_instance (running_workflow_step_id = "r-workflow-step-000" )
349+ response = utaa .create_workflow (workflow_definition = {"name" : "blah" })
350+ response = utaa .create_running_workflow (
351+ user_id = "dlister" ,
352+ workflow_id = response ["id" ],
353+ project_id = TEST_PROJECT_ID ,
354+ variables = {},
355+ )
356+ response , _ = utaa .create_running_workflow_step (
357+ running_workflow_id = response ["id" ], step = "step-1"
358+ )
359+ rwfs_id = response ["id" ]
360+ response = utaa .create_instance (running_workflow_step_id = rwfs_id )
339361 instance_id = response ["id" ]
340362
341363 # Act
342364 response , _ = utaa .get_instance (instance_id = instance_id )
343365
344366 # Assert
345- assert response ["running_workflow_step_id" ] == "r-workflow-step-000"
367+ assert response ["running_workflow_step_id" ] == rwfs_id
368+
369+
370+ def test_create_instance_and_get_step_instance_directory ():
371+ # Arrange
372+ utaa = UnitTestWorkflowAPIAdapter ()
373+ response = utaa .create_workflow (workflow_definition = {"name" : "blah" })
374+ response = utaa .create_running_workflow (
375+ user_id = "dlister" ,
376+ workflow_id = response ["id" ],
377+ project_id = TEST_PROJECT_ID ,
378+ variables = {},
379+ )
380+ response , _ = utaa .create_running_workflow_step (
381+ running_workflow_id = response ["id" ], step = "step-1"
382+ )
383+ rwfs_id = response ["id" ]
384+ response = utaa .create_instance (running_workflow_step_id = rwfs_id )
385+ i_id = response ["id" ]
386+
387+ # Act
388+ response , _ = utaa .get_running_workflow_step (running_workflow_step_id = rwfs_id )
389+
390+ # Assert
391+ assert "instance_directory" in response
392+ assert response ["instance_directory" ] == f".{ i_id } "
393+
394+
395+ def test_create_instance_and_get_step_instance_directory_by_name ():
396+ # Arrange
397+ utaa = UnitTestWorkflowAPIAdapter ()
398+ response = utaa .create_workflow (workflow_definition = {"name" : "blah" })
399+ wf_id = response ["id" ]
400+ response = utaa .create_running_workflow (
401+ user_id = "dlister" ,
402+ workflow_id = wf_id ,
403+ project_id = TEST_PROJECT_ID ,
404+ variables = {},
405+ )
406+ rwf_id = response ["id" ]
407+ response , _ = utaa .create_running_workflow_step (
408+ running_workflow_id = rwf_id , step = "step-1"
409+ )
410+ rwfs_id = response ["id" ]
411+ response = utaa .create_instance (running_workflow_step_id = rwfs_id )
412+ i_id = response ["id" ]
413+
414+ # Act
415+ response , _ = utaa .get_running_workflow_step_by_name (
416+ running_workflow_id = rwf_id , name = "step-1"
417+ )
418+
419+ # Assert
420+ assert "instance_directory" in response
421+ assert response ["instance_directory" ] == f".{ i_id } "
346422
347423
348424def test_get_workflow_steps_driving_this_step_when_1st_step ():
0 commit comments