Skip to content

Commit d13be53

Browse files
committed
adding a test
1 parent 5e88735 commit d13be53

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

qiita_pet/test/test_software.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,37 @@ def test_get(self):
5757
self.assertIn('FASTA upstream workflow', body)
5858
DefaultWorkflow(2).active = True
5959

60+
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
63+
with TRN:
64+
# 5 per_sample_FASTQ
65+
sql = """INSERT INTO qiita.default_workflow
66+
(name, artifact_type_id, description, parameters)
67+
VALUES ('', 5, '', '{"prep": {}, "sample": {}}')
68+
RETURNING default_workflow_id"""
69+
TRN.add(sql)
70+
wid = TRN.execute_fetchlast()
71+
# 11 & 12 are per-sample-FASTQ split libraries commands
72+
sql = """INSERT INTO qiita.default_workflow_node
73+
(default_workflow_id, default_parameter_set_id)
74+
VALUES (%s, 11), (%s, 12)
75+
RETURNING default_workflow_node_id"""
76+
TRN.add(sql, [wid, wid])
77+
nid = TRN.execute_fetchflatten()
78+
sql = """UPDATE qiita.command_parameter SET required = false"""
79+
TRN.add(sql)
80+
TRN.execute()
81+
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]))
90+
6091
def test_retrive_workflows(self):
6192
# we should see all 3 workflows
6293
DefaultWorkflow(2).active = False

0 commit comments

Comments
 (0)