@@ -82,6 +82,14 @@ def test_list_orchestration_system(
8282 assert Counter (
8383 str (orchestration_system .name ) for orchestration_system in result
8484 ) == Counter (orchestration_system_names )
85+ task_counts = {
86+ str (orchestration_system .name ): orchestration_system .task_count
87+ for orchestration_system in result
88+ }
89+ if "HydroServer" in orchestration_system_names :
90+ assert task_counts ["HydroServer" ] == 0
91+ if "Test Streaming Data Loader" in orchestration_system_names :
92+ assert task_counts ["Test Streaming Data Loader" ] == 1
8593 assert (
8694 OrchestrationSystemSummaryResponse .from_orm (orchestration_system )
8795 for orchestration_system in result
@@ -162,6 +170,7 @@ def test_get_orchestration_system(
162170 principal = get_principal (principal ), uid = uuid .UUID (orchestration_system )
163171 )
164172 assert orchestration_system_get .name == message
173+ assert orchestration_system_get .task_count == 1
165174 assert OrchestrationSystemSummaryResponse .from_orm (orchestration_system_get )
166175
167176
@@ -296,12 +305,42 @@ def test_create_orchestration_system(
296305@pytest .mark .parametrize (
297306 "principal, orchestration_system, message, error_code" ,
298307 [
299- ("admin" , "7cb900d2-eb11-4a59-a05b-dd02d95af312" , None , None ),
300- ("admin" , "7cb900d2-eb11-4a59-a05b-dd02d95af312" , None , None ),
301- ("owner" , "7cb900d2-eb11-4a59-a05b-dd02d95af312" , None , None ),
302- ("owner" , "7cb900d2-eb11-4a59-a05b-dd02d95af312" , None , None ),
303- ("editor" , "7cb900d2-eb11-4a59-a05b-dd02d95af312" , None , None ),
304- ("editor" , "7cb900d2-eb11-4a59-a05b-dd02d95af312" , None , None ),
308+ (
309+ "admin" ,
310+ "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
311+ "Cannot delete orchestration system while 1 task is still linked to it." ,
312+ 409 ,
313+ ),
314+ (
315+ "admin" ,
316+ "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
317+ "Cannot delete orchestration system while 1 task is still linked to it." ,
318+ 409 ,
319+ ),
320+ (
321+ "owner" ,
322+ "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
323+ "Cannot delete orchestration system while 1 task is still linked to it." ,
324+ 409 ,
325+ ),
326+ (
327+ "owner" ,
328+ "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
329+ "Cannot delete orchestration system while 1 task is still linked to it." ,
330+ 409 ,
331+ ),
332+ (
333+ "editor" ,
334+ "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
335+ "Cannot delete orchestration system while 1 task is still linked to it." ,
336+ 409 ,
337+ ),
338+ (
339+ "editor" ,
340+ "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
341+ "Cannot delete orchestration system while 1 task is still linked to it." ,
342+ 409 ,
343+ ),
305344 (
306345 "viewer" ,
307346 "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
@@ -392,12 +431,42 @@ def test_edit_orchestration_system(
392431@pytest .mark .parametrize (
393432 "principal, orchestration_system, message, error_code" ,
394433 [
395- ("admin" , "7cb900d2-eb11-4a59-a05b-dd02d95af312" , None , None ),
396- ("admin" , "7cb900d2-eb11-4a59-a05b-dd02d95af312" , None , None ),
397- ("owner" , "7cb900d2-eb11-4a59-a05b-dd02d95af312" , None , None ),
398- ("owner" , "7cb900d2-eb11-4a59-a05b-dd02d95af312" , None , None ),
399- ("editor" , "7cb900d2-eb11-4a59-a05b-dd02d95af312" , None , None ),
400- ("editor" , "7cb900d2-eb11-4a59-a05b-dd02d95af312" , None , None ),
434+ (
435+ "admin" ,
436+ "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
437+ "Cannot delete orchestration system while 1 task is still linked to it." ,
438+ 409 ,
439+ ),
440+ (
441+ "admin" ,
442+ "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
443+ "Cannot delete orchestration system while 1 task is still linked to it." ,
444+ 409 ,
445+ ),
446+ (
447+ "owner" ,
448+ "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
449+ "Cannot delete orchestration system while 1 task is still linked to it." ,
450+ 409 ,
451+ ),
452+ (
453+ "owner" ,
454+ "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
455+ "Cannot delete orchestration system while 1 task is still linked to it." ,
456+ 409 ,
457+ ),
458+ (
459+ "editor" ,
460+ "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
461+ "Cannot delete orchestration system while 1 task is still linked to it." ,
462+ 409 ,
463+ ),
464+ (
465+ "editor" ,
466+ "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
467+ "Cannot delete orchestration system while 1 task is still linked to it." ,
468+ 409 ,
469+ ),
401470 (
402471 "viewer" ,
403472 "7cb900d2-eb11-4a59-a05b-dd02d95af312" ,
@@ -475,3 +544,21 @@ def test_delete_orchestration_system(
475544 principal = get_principal (principal ), uid = uuid .UUID (orchestration_system )
476545 )
477546 assert orchestration_system_delete == "Orchestration system deleted"
547+
548+
549+ def test_delete_unlinked_orchestration_system (get_principal ):
550+ orchestration_system = orchestration_system_service .create (
551+ principal = get_principal ("owner" ),
552+ data = OrchestrationSystemPostBody (
553+ name = "Temporary" ,
554+ workspace_id = uuid .UUID ("b27c51a0-7374-462d-8a53-d97d47176c10" ),
555+ orchestration_system_type = "SDL" ,
556+ ),
557+ )
558+
559+ result = orchestration_system_service .delete (
560+ principal = get_principal ("owner" ),
561+ uid = orchestration_system .id ,
562+ )
563+
564+ assert result == "Orchestration system deleted"
0 commit comments