@@ -58,8 +58,8 @@ def test_get(self):
5858 DefaultWorkflow (2 ).active = True
5959
6060 def test_retrive_workflows_standalone (self ):
61- # let's create a new workflow, add 2 commands, and make parameters not
62- # required: two standalone commands
61+ # let's create a new workflow, add 1 commands, and make parameters not
62+ # required to make sure the stanalone is "active"
6363 with TRN :
6464 # 5 per_sample_FASTQ
6565 sql = """INSERT INTO qiita.default_workflow
@@ -68,25 +68,40 @@ def test_retrive_workflows_standalone(self):
6868 RETURNING default_workflow_id"""
6969 TRN .add (sql )
7070 wid = TRN .execute_fetchlast ()
71- # 11 & 12 are per-sample-FASTQ split libraries commands
71+ # 11 is per-sample-FASTQ split libraries commands
7272 sql = """INSERT INTO qiita.default_workflow_node
7373 (default_workflow_id, default_parameter_set_id)
74- VALUES (%s, 11), (%s, 12)
74+ VALUES (%s, 11)
7575 RETURNING default_workflow_node_id"""
76- TRN .add (sql , [wid , wid ])
76+ TRN .add (sql , [wid ])
7777 nid = TRN .execute_fetchflatten ()
7878 sql = """UPDATE qiita.command_parameter SET required = false"""
7979 TRN .add (sql )
8080 TRN .execute ()
8181
82- obs = _retrive_workflows (True )[- 1 ]
83- exp_value = f'input_params_{ nid [0 ]} _per_sample_FASTQ'
84- # there should be a single "input" node
85- self .assertEqual (1 , len (
86- [x for x in obs ['nodes' ] if x [0 ] == exp_value ]))
87- # and 2 edges
88- self .assertEqual (2 , len (
89- [x for x in obs ['edges' ] if x [0 ] == exp_value ]))
82+ # here we expect 1 input node and 1 edge
83+ obs = _retrive_workflows (True )[- 1 ]
84+ exp_value = f'input_params_{ nid [0 ]} _per_sample_FASTQ'
85+ self .assertEqual (1 , len (
86+ [x for x in obs ['nodes' ] if x [0 ] == exp_value ]))
87+ self .assertEqual (1 , len (
88+ [x for x in obs ['edges' ] if x [0 ] == exp_value ]))
89+
90+ # now let's insert another command using the same input
91+ with TRN :
92+ # 12 is per-sample-FASTQ split libraries commands
93+ sql = """INSERT INTO qiita.default_workflow_node
94+ (default_workflow_id, default_parameter_set_id)
95+ VALUES (%s, 12)"""
96+ TRN .add (sql , [wid ])
97+ TRN .execute ()
98+
99+ # we should still have 1 node but now with 2 edges
100+ obs = _retrive_workflows (True )[- 1 ]
101+ self .assertEqual (1 , len (
102+ [x for x in obs ['nodes' ] if x [0 ] == exp_value ]))
103+ self .assertEqual (2 , len (
104+ [x for x in obs ['edges' ] if x [0 ] == exp_value ]))
90105
91106 def test_retrive_workflows (self ):
92107 # we should see all 3 workflows
0 commit comments