6
6
# The full license is in the file LICENSE, distributed with this software.
7
7
# -----------------------------------------------------------------------------
8
8
from qp_klp .WorkflowFactory import WorkflowFactory
9
- from unittest import TestCase
9
+ from unittest import main
10
10
from os import makedirs
11
11
from qp_klp .Protocol import (PROTOCOL_NAME_ILLUMINA ,
12
12
PROTOCOL_NAME_TELLSEQ )
13
13
from qp_klp .Assays import (ASSAY_NAME_METAGENOMIC ,
14
14
ASSAY_NAME_METATRANSCRIPTOMIC ,
15
15
ASSAY_NAME_AMPLICON )
16
16
from shutil import rmtree
17
+ from qiita_client .testing import PluginTestCase
18
+ from qiita_client .exceptions import NotFoundError
17
19
18
20
19
- class WorkflowFactoryTests (TestCase ):
21
+ class WorkflowFactoryTests (PluginTestCase ):
20
22
def setUp (self ):
21
23
self .remove_these = []
22
24
@@ -100,7 +102,7 @@ def test_invalid_sample_sheets(self):
100
102
def test_metagenomic_workflow_creation (self ):
101
103
kwargs = {"uif_path" : "qp_klp/tests/data/sample-sheets/metagenomic/"
102
104
"illumina/good_sheet1.csv" ,
103
- "qclient" : None ,
105
+ "qclient" : self . qclient ,
104
106
"lane_number" : "1" ,
105
107
"config_fp" : "qp_klp/tests/data/configuration.json" ,
106
108
"run_identifier" : "211021_A00000_0000_SAMPLE" ,
@@ -117,10 +119,14 @@ def test_metagenomic_workflow_creation(self):
117
119
self .assertEqual (wf .protocol_type , PROTOCOL_NAME_ILLUMINA )
118
120
self .assertEqual (wf .assay_type , ASSAY_NAME_METAGENOMIC )
119
121
122
+ with self .assertRaisesRegex (
123
+ NotFoundError , '{"message": "Study not found"}' ):
124
+ wf .execute_pipeline ()
125
+
120
126
def test_metatranscriptomic_workflow_creation (self ):
121
127
kwargs = {"uif_path" : "qp_klp/tests/data/sample-sheets/"
122
128
"metatranscriptomic/illumina/good_sheet1.csv" ,
123
- "qclient" : None ,
129
+ "qclient" : self . qclient ,
124
130
"lane_number" : "1" ,
125
131
"config_fp" : "qp_klp/tests/data/configuration.json" ,
126
132
"run_identifier" : "211021_A00000_0000_SAMPLE" ,
@@ -137,9 +143,13 @@ def test_metatranscriptomic_workflow_creation(self):
137
143
self .assertEqual (wf .protocol_type , PROTOCOL_NAME_ILLUMINA )
138
144
self .assertEqual (wf .assay_type , ASSAY_NAME_METATRANSCRIPTOMIC )
139
145
146
+ with self .assertRaisesRegex (
147
+ NotFoundError , '{"message": "Study not found"}' ):
148
+ wf .execute_pipeline ()
149
+
140
150
def test_amplicon_workflow_creation (self ):
141
151
kwargs = {"uif_path" : "qp_klp/tests/data/pre-preps/good_pre_prep1.txt" ,
142
- "qclient" : None ,
152
+ "qclient" : self . qclient ,
143
153
"config_fp" : "qp_klp/tests/data/configuration.json" ,
144
154
"run_identifier" : "211021_A00000_0000_SAMPLE" ,
145
155
"output_dir" : "qp_klp/tests/test_output" ,
@@ -155,10 +165,14 @@ def test_amplicon_workflow_creation(self):
155
165
self .assertEqual (wf .protocol_type , PROTOCOL_NAME_ILLUMINA )
156
166
self .assertEqual (wf .assay_type , ASSAY_NAME_AMPLICON )
157
167
168
+ with self .assertRaisesRegex (
169
+ NotFoundError , '{"message": "Study not found"}' ):
170
+ wf .execute_pipeline ()
171
+
158
172
def test_tellseq_workflow_creation (self ):
159
173
kwargs = {"uif_path" : "qp_klp/tests/data/sample-sheets/metagenomic/"
160
174
"tellseq/good_sheet1.csv" ,
161
- "qclient" : None ,
175
+ "qclient" : self . qclient ,
162
176
"config_fp" : "qp_klp/tests/data/configuration.json" ,
163
177
"run_identifier" : "211021_A00000_0000_SAMPLE" ,
164
178
"output_dir" : "qp_klp/tests/test_output" ,
@@ -174,3 +188,11 @@ def test_tellseq_workflow_creation(self):
174
188
# confirm that the proper type of workflow was generated.
175
189
self .assertEqual (wf .protocol_type , PROTOCOL_NAME_TELLSEQ )
176
190
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