@@ -797,7 +797,7 @@ def sample_yadage_workflow_in_db(
797797 next (sample_workflow_workspace (relative_workspace_path ))
798798 workflow = Workflow (
799799 id_ = workflow_id ,
800- name = "sample_serial_workflow_1 " ,
800+ name = "sample_yadage_workflow_1 " ,
801801 owner_id = user0 .id_ ,
802802 reana_specification = yadage_workflow_with_name ["reana_specification" ],
803803 operational_options = {},
@@ -814,6 +814,47 @@ def sample_yadage_workflow_in_db(
814814 session .commit ()
815815
816816
817+ @pytest .fixture ()
818+ def sample_yadage_workflow_in_db_owned_by_user1 (
819+ app ,
820+ user1 ,
821+ session ,
822+ yadage_workflow_with_name ,
823+ sample_workflow_workspace ,
824+ tmp_shared_volume_path ,
825+ ):
826+ """Create a sample workflow in the database.
827+
828+ Scope: function
829+
830+ Adds a sample yadage workflow in the DB.
831+ """
832+ from reana_db .models import Workflow
833+
834+ workflow_id = uuid4 ()
835+ relative_workspace_path = build_workspace_path (
836+ user1 .id_ , workflow_id , tmp_shared_volume_path
837+ )
838+ next (sample_workflow_workspace (relative_workspace_path ))
839+ workflow = Workflow (
840+ id_ = workflow_id ,
841+ name = "sample_yadage_workflow_2" ,
842+ owner_id = user1 .id_ ,
843+ reana_specification = yadage_workflow_with_name ["reana_specification" ],
844+ operational_options = {},
845+ type_ = yadage_workflow_with_name ["reana_specification" ]["workflow" ]["type" ],
846+ logs = "" ,
847+ workspace_path = relative_workspace_path ,
848+ )
849+ session .add (workflow )
850+ session .commit ()
851+ yield workflow
852+ for resource in workflow .resources :
853+ session .delete (resource )
854+ session .delete (workflow )
855+ session .commit ()
856+
857+
817858@pytest .fixture ()
818859def sample_serial_workflow_in_db (
819860 app ,
@@ -855,6 +896,47 @@ def sample_serial_workflow_in_db(
855896 session .commit ()
856897
857898
899+ @pytest .fixture ()
900+ def sample_serial_workflow_in_db_owned_by_user1 (
901+ app ,
902+ user1 ,
903+ session ,
904+ serial_workflow ,
905+ sample_workflow_workspace ,
906+ tmp_shared_volume_path ,
907+ ):
908+ """Create a sample workflow in the database.
909+
910+ Scope: function
911+
912+ Adds a sample serial workflow in the DB.
913+ """
914+ from reana_db .models import Workflow
915+
916+ workflow_id = uuid4 ()
917+ relative_workspace_path = build_workspace_path (
918+ user1 .id_ , workflow_id , tmp_shared_volume_path
919+ )
920+ next (sample_workflow_workspace (relative_workspace_path ))
921+ workflow = Workflow (
922+ id_ = workflow_id ,
923+ name = "sample_serial_workflow_2" ,
924+ owner_id = user1 .id_ ,
925+ reana_specification = serial_workflow ["reana_specification" ],
926+ operational_options = {},
927+ type_ = serial_workflow ["reana_specification" ]["workflow" ]["type" ],
928+ logs = "" ,
929+ workspace_path = relative_workspace_path ,
930+ )
931+ session .add (workflow )
932+ session .commit ()
933+ yield workflow
934+ for resource in workflow .resources :
935+ session .delete (resource )
936+ session .delete (workflow )
937+ session .commit ()
938+
939+
858940def sample_condition_for_starting_queued_workflows ():
859941 """Sample always true condition."""
860942 return True
0 commit comments