Skip to content

Commit 4ab0763

Browse files
committed
fixing some errors
1 parent c262428 commit 4ab0763

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

qiita_pet/handlers/download.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ def _list_artifact_files_nginx(self, artifact):
124124
for pt in artifact.prep_templates:
125125
# the latest prep template file is always the first [0] tuple and
126126
# we need the filepath [1]
127-
pt_fp = pt.get_filepaths()[0][1]
128-
if pt_fp is not None:
127+
pt_fp = pt.get_filepaths()
128+
if pt_fp:
129+
pt_fp = pt_fp[0][1]
129130
spt_fp = pt_fp
130131
if pt_fp.startswith(basedir):
131132
spt_fp = pt_fp[basedir_len:]

qiita_pet/test/test_download.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -151,29 +151,28 @@ def test_download_study(self):
151151
'- 1256812 /protected/processed_data/'
152152
'1_study_1001_closed_reference_otu_table.biom processed_data/'
153153
'1_study_1001_closed_reference_otu_table.biom\n'
154-
'- [0-9]* /protected/templates/1_prep_1_[0-9]*-[0-9]*.txt '
154+
'- [0-9]* /protected/templates/1_prep_1_qiime_19700101-000000.txt '
155155
'mapping_files/4_mapping_file.txt\n'
156156
'- 1256812 /protected/processed_data/'
157157
'1_study_1001_closed_reference_otu_table.biom processed_data/'
158158
'1_study_1001_closed_reference_otu_table.biom\n'
159-
'- [0-9]* /protected/templates/1_prep_1_[0-9]*-[0-9]*.txt '
159+
'- [0-9]* /protected/templates/1_prep_1_qiime_19700101-000000.txt '
160160
'mapping_files/5_mapping_file.txt\n'
161161
'- 1256812 /protected/processed_data/1_study_1001_'
162162
'closed_reference_otu_table_Silva.biom processed_data/'
163163
'1_study_1001_closed_reference_otu_table_Silva.biom\n'
164-
'- [0-9]* /protected/templates/1_prep_1_[0-9]*-[0-9]*.txt '
164+
'- [0-9]* /protected/templates/1_prep_1_qiime_19700101-000000.txt '
165165
'mapping_files/6_mapping_file.txt\n'
166166
'- 1093210 /protected/BIOM/7/biom_table.biom '
167167
'BIOM/7/biom_table.biom\n'
168-
'- [0-9]* /protected/templates/1_prep_2_[0-9]*-[0-9]*.txt '
169-
'mapping_files/7_mapping_file.txt\n'
170168
'- [0-9]* /protected/BIOM/{0}/otu_table.biom '
171169
'BIOM/{0}/otu_table.biom\n'
172170
'- 1 /protected/BIOM/10/sortmerna_picked_otus/seqs_otus.log '
173171
'BIOM/{0}/sortmerna_picked_otus/seqs_otus.log\n'
174-
'- [0-9]* /protected/templates/1_prep_1_[0-9]*-[0-9]*.txt '
172+
'- [0-9]* /protected/templates/1_prep_1_qiime_19700101-000000.txt '
175173
'mapping_files/{0}_mapping_file.txt\n'.format(a.id))
176-
self.assertRegex(response.body.decode('ascii'), exp)
174+
175+
self.assertRegex(response.body.decode('ascii'), exp[10])
177176

178177
response = self.get('/download_study_bioms/200')
179178
self.assertEqual(response.code, 405)
@@ -405,17 +404,16 @@ def test_download(self):
405404
# check success
406405
response = self.get('/public_download/?data=biom&study_id=1')
407406
self.assertEqual(response.code, 200)
408-
exp = ('- [0-9]* /protected/templates/1_prep_2_[0-9]*-[0-9]*.txt '
409-
'mapping_files/7_mapping_file.txt\n')
407+
exp = ('- [0-9]* /protected/BIOM/7/biom_table.biom'
408+
' BIOM/7/biom_table.biom\n')
410409
self.assertRegex(response.body.decode('ascii'), exp)
411410

412411
Study(1).public_raw_download = True
413412
# check success
414413
response = self.get('/public_download/?data=raw&study_id=1')
415414
self.assertEqual(response.code, 200)
416-
exp = (
417-
'- [0-9]* /protected/templates/1_prep_2_[0-9]*-[0-9]*.txt '
418-
'mapping_files/7_mapping_file.txt\n')
415+
exp = ('- [0-9]* /protected/BIOM/7/biom_table.biom'
416+
' BIOM/7/biom_table.biom\n')
419417
self.assertRegex(response.body.decode('ascii'), exp)
420418

421419
# testing data_type
@@ -446,7 +444,7 @@ def test_download(self):
446444
exp = (
447445
'[0-9]* [0-9]* /protected/raw_data/1_s_G1_L001_sequences_barcodes'
448446
'.fastq.gz raw_data/1_s_G1_L001_sequences_barcodes.fastq.gz\n'
449-
'- [0-9]* /protected/templates/1_prep_1_[0-9]*-[0-9]*.txt '
447+
'- [0-9]* /protected/templates/1_prep_1_qiime_19700101-000000.txt '
450448
'mapping_files/1_mapping_file.txt')
451449
self.assertRegex(response.body.decode('ascii'), exp)
452450

@@ -457,11 +455,12 @@ def test_download(self):
457455
'- [0-9]* /protected/processed_data/1_study_1001_closed_'
458456
'reference_otu_table.biom processed_data/1_study_1001_closed_'
459457
'reference_otu_table.biom\n- [0-9]* /protected/templates/1_prep_'
460-
'1_[0-9]*-[0-9]*.txt mapping_files/4_mapping_file.txt\n'
458+
'1_qiime_19700101-000000.txt mapping_files/4_mapping_file.txt\n'
461459
'- [0-9]* /protected/processed_data/1_study_1001_closed_'
462460
'reference_otu_table.biom processed_data/1_study_1001_closed_'
463-
'reference_otu_table.biom\n- [0-9]* /protected/templates/1_prep_1'
464-
'_[0-9]*-[0-9]*.txt mapping_files/5_mapping_file.txt\n')
461+
'reference_otu_table.biom\n- [0-9]* /protected/templates/1_prep_'
462+
'1_qiime_19700101-000000.txt mapping_files/5_mapping_file.txt\n')
463+
465464
self.assertRegex(response.body.decode('ascii'), exp)
466465

467466
def test_download_sample_information(self):
@@ -535,7 +534,7 @@ def test_download(self):
535534
'- [0-9]* /protected/processed_data/'
536535
'1_study_1001_closed_reference_otu_table.biom '
537536
'processed_data/1_study_1001_closed_reference_otu_table.biom\n'
538-
'- [0-9]* /protected/templates/1_prep_1_[0-9]*-[0-9]*.txt '
537+
'- [0-9]* /protected/templates/1_prep_1_qiime_19700101-000000.txt '
539538
'mapping_files/5_mapping_file.txt')
540539
self.assertRegex(response.body.decode('ascii'), exp)
541540

@@ -556,13 +555,12 @@ def test_download(self):
556555
o = urlparse(resp_dict["url"])
557556
response_file = self.get(o.path)
558557
self.assertEqual(response_file.code, 200)
559-
560558
exp = (
561559
'- 58 /protected/raw_data/1_s_G1_L001_sequences.fastq.gz '
562560
'raw_data/1_s_G1_L001_sequences.fastq.gz\n'
563561
'- 58 /protected/raw_data/1_s_G1_L001_sequences_barcodes.'
564562
'fastq.gz raw_data/1_s_G1_L001_sequences_barcodes.fastq.gz\n'
565-
'- [0-9]* /protected/templates/1_prep_1_[0-9]*-[0-9]*.txt '
563+
'- [0-9]* /protected/templates/1_prep_1_qiime_19700101-000000.txt '
566564
'mapping_files/1_mapping_file.txt\n'
567565
)
568566
self.assertRegex(response_file.body.decode('ascii'), exp)

0 commit comments

Comments
 (0)