Skip to content

Commit 6f08836

Browse files
committed
update tests with proc_data_info
1 parent 9227ee3 commit 6f08836

File tree

2 files changed

+55
-4
lines changed

2 files changed

+55
-4
lines changed

qiita_pet/handlers/study_handlers/listing_handlers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,15 @@ def _build_study_info(user, study_proc=None, proc_samples=None):
6262
Both study_proc and proc_samples must be passed, or neither passed.
6363
"""
6464
# Logic check to make sure both needed parts passed
65+
build_info = False
6566
if study_proc is not None and proc_samples is None:
6667
raise IncompetentQiitaDeveloperError(
6768
'Must pass proc_samples when study_proc given')
6869
elif proc_samples is not None and study_proc is None:
6970
raise IncompetentQiitaDeveloperError(
7071
'Must pass study_proc when proc_samples given')
72+
elif proc_samples is None:
73+
build_info = True
7174

7275
# get list of studies for table
7376
study_list = user.user_studies.union(
@@ -89,7 +92,7 @@ def _build_study_info(user, study_proc=None, proc_samples=None):
8992
study = Study(info['study_id'])
9093
status = study.status
9194
# if needed, get all the proc data info since no search results passed
92-
if study_proc is None:
95+
if build_info:
9396
proc_data = study.processed_data()
9497
proc_samples = {}
9598
study_proc = {study.id: proc_data}

qiita_pet/test/test_study_handlers.py

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,31 @@ def setUp(self):
4040
'pmid': '<a target="_blank" href="http://www.ncbi.nlm.nih.gov/'
4141
'pubmed/123456">123456</a>, <a target="_blank" href="http:'
4242
'//www.ncbi.nlm.nih.gov/pubmed/7891011">7891011</a>',
43-
'pi': '<a target="_blank" href="mailto:PI_dude@foo.bar">PIDude</a>'
43+
'pi': '<a target="_blank" href="mailto:PI_dude@foo.bar">'
44+
'PIDude</a>',
45+
'proc_data_info': [{
46+
'pid': 1,
47+
'processed_date': '2012-10-01 09:30:27',
48+
'data_type': '18S',
49+
'algorithm': 'uclust',
50+
'reference_name': 'Greengenes',
51+
'reference_version': '13_8',
52+
'taxonomy_filepath': 'GreenGenes_13_8_97_otu_taxonomy.txt',
53+
'sequence_filepath': 'GreenGenes_13_8_97_otus.fasta',
54+
'tree_filepath': 'GreenGenes_13_8_97_otus.tree',
55+
'similarity': 0.97,
56+
'enable_rev_strand_match': True,
57+
'suppress_new_clusters': True,
58+
'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195',
59+
'1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176',
60+
'1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200',
61+
'1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198',
62+
'1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190',
63+
'1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182',
64+
'1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197',
65+
'1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187',
66+
'1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']
67+
}]
4468
}]
4569
super(TestHelpers, self).setUp()
4670

@@ -86,7 +110,8 @@ def test_build_study_info_new_study(self):
86110
"btn-primary btn-xs' data-toggle='modal' data-target='#share-study"
87111
"-modal-view' onclick='modify_sharing(2);'>Modify</a>",
88112
'pmid': '', 'pi':
89-
'<a target="_blank" href="mailto:PI_dude@foo.bar">PIDude</a>'})
113+
'<a target="_blank" href="mailto:PI_dude@foo.bar">PIDude</a>',
114+
'proc_data_info': []})
90115
self.assertEqual(obs, self.exp)
91116

92117

@@ -306,7 +331,30 @@ class TestSearchStudiesAJAX(TestHandlerBase):
306331
'pmid': '<a target="_blank" href="http://www.ncbi.nlm.nih.gov/'
307332
'pubmed/123456">123456</a>, <a target="_blank" href="http://www.'
308333
'ncbi.nlm.nih.gov/pubmed/7891011">7891011</a>',
309-
'num_raw_data': 4}]}
334+
'num_raw_data': 4,
335+
'proc_data_info': [{
336+
'pid': 1,
337+
'processed_date': '2012-10-01 09:30:27',
338+
'data_type': '18S',
339+
'algorithm': 'uclust',
340+
'reference_name': 'Greengenes',
341+
'reference_version': '13_8',
342+
'taxonomy_filepath': 'GreenGenes_13_8_97_otu_taxonomy.txt',
343+
'sequence_filepath': 'GreenGenes_13_8_97_otus.fasta',
344+
'tree_filepath': 'GreenGenes_13_8_97_otus.tree',
345+
'similarity': 0.97,
346+
'enable_rev_strand_match': True,
347+
'suppress_new_clusters': True,
348+
'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195',
349+
'1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176',
350+
'1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200',
351+
'1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198',
352+
'1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190',
353+
'1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182',
354+
'1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197',
355+
'1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187',
356+
'1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']
357+
}]}]}
310358
empty = {'aaData': [],
311359
'iTotalDisplayRecords': 0,
312360
'iTotalRecords': 0,

0 commit comments

Comments
 (0)