66# The full license is in the file LICENSE, distributed with this software.
77# -----------------------------------------------------------------------------
88from qp_klp .WorkflowFactory import WorkflowFactory
9- from unittest import TestCase
9+ from unittest import main
1010from os import makedirs
1111from qp_klp .Protocol import (PROTOCOL_NAME_ILLUMINA ,
1212 PROTOCOL_NAME_TELLSEQ )
1313from qp_klp .Assays import (ASSAY_NAME_METAGENOMIC ,
1414 ASSAY_NAME_METATRANSCRIPTOMIC ,
1515 ASSAY_NAME_AMPLICON )
1616from shutil import rmtree
17+ from qiita_client .testing import PluginTestCase
18+ from qiita_client .exceptions import NotFoundError
1719
1820
19- class WorkflowFactoryTests (TestCase ):
21+ class WorkflowFactoryTests (PluginTestCase ):
2022 def setUp (self ):
2123 self .remove_these = []
2224
@@ -100,7 +102,7 @@ def test_invalid_sample_sheets(self):
100102 def test_metagenomic_workflow_creation (self ):
101103 kwargs = {"uif_path" : "qp_klp/tests/data/sample-sheets/metagenomic/"
102104 "illumina/good_sheet1.csv" ,
103- "qclient" : None ,
105+ "qclient" : self . qclient ,
104106 "lane_number" : "1" ,
105107 "config_fp" : "qp_klp/tests/data/configuration.json" ,
106108 "run_identifier" : "211021_A00000_0000_SAMPLE" ,
@@ -117,10 +119,14 @@ def test_metagenomic_workflow_creation(self):
117119 self .assertEqual (wf .protocol_type , PROTOCOL_NAME_ILLUMINA )
118120 self .assertEqual (wf .assay_type , ASSAY_NAME_METAGENOMIC )
119121
122+ with self .assertRaisesRegex (
123+ NotFoundError , '{"message": "Study not found"}' ):
124+ wf .execute_pipeline ()
125+
120126 def test_metatranscriptomic_workflow_creation (self ):
121127 kwargs = {"uif_path" : "qp_klp/tests/data/sample-sheets/"
122128 "metatranscriptomic/illumina/good_sheet1.csv" ,
123- "qclient" : None ,
129+ "qclient" : self . qclient ,
124130 "lane_number" : "1" ,
125131 "config_fp" : "qp_klp/tests/data/configuration.json" ,
126132 "run_identifier" : "211021_A00000_0000_SAMPLE" ,
@@ -137,9 +143,13 @@ def test_metatranscriptomic_workflow_creation(self):
137143 self .assertEqual (wf .protocol_type , PROTOCOL_NAME_ILLUMINA )
138144 self .assertEqual (wf .assay_type , ASSAY_NAME_METATRANSCRIPTOMIC )
139145
146+ with self .assertRaisesRegex (
147+ NotFoundError , '{"message": "Study not found"}' ):
148+ wf .execute_pipeline ()
149+
140150 def test_amplicon_workflow_creation (self ):
141151 kwargs = {"uif_path" : "qp_klp/tests/data/pre-preps/good_pre_prep1.txt" ,
142- "qclient" : None ,
152+ "qclient" : self . qclient ,
143153 "config_fp" : "qp_klp/tests/data/configuration.json" ,
144154 "run_identifier" : "211021_A00000_0000_SAMPLE" ,
145155 "output_dir" : "qp_klp/tests/test_output" ,
@@ -155,10 +165,14 @@ def test_amplicon_workflow_creation(self):
155165 self .assertEqual (wf .protocol_type , PROTOCOL_NAME_ILLUMINA )
156166 self .assertEqual (wf .assay_type , ASSAY_NAME_AMPLICON )
157167
168+ with self .assertRaisesRegex (
169+ NotFoundError , '{"message": "Study not found"}' ):
170+ wf .execute_pipeline ()
171+
158172 def test_tellseq_workflow_creation (self ):
159173 kwargs = {"uif_path" : "qp_klp/tests/data/sample-sheets/metagenomic/"
160174 "tellseq/good_sheet1.csv" ,
161- "qclient" : None ,
175+ "qclient" : self . qclient ,
162176 "config_fp" : "qp_klp/tests/data/configuration.json" ,
163177 "run_identifier" : "211021_A00000_0000_SAMPLE" ,
164178 "output_dir" : "qp_klp/tests/test_output" ,
@@ -174,3 +188,11 @@ def test_tellseq_workflow_creation(self):
174188 # confirm that the proper type of workflow was generated.
175189 self .assertEqual (wf .protocol_type , PROTOCOL_NAME_TELLSEQ )
176190 self .assertEqual (wf .assay_type , ASSAY_NAME_METAGENOMIC )
191+
192+ with self .assertRaisesRegex (
193+ NotFoundError , '{"message": "Study not found"}' ):
194+ wf .execute_pipeline ()
195+
196+
197+ if __name__ == '__main__' :
198+ main ()
0 commit comments