From 17e8db12834c463ab75267c1ebd88110a71cbbdb Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Mon, 3 Apr 2017 16:29:58 -0600 Subject: [PATCH] fix errors --- qiita_db/test/test_artifact.py | 17 +- qiita_db/test/test_util.py | 188 ++++++++++-------- .../handlers/api_proxy/tests/test_artifact.py | 21 +- .../api_proxy/tests/test_prep_template.py | 2 +- 4 files changed, 127 insertions(+), 101 deletions(-) diff --git a/qiita_db/test/test_artifact.py b/qiita_db/test/test_artifact.py index 202ae8630..4669dc39c 100644 --- a/qiita_db/test/test_artifact.py +++ b/qiita_db/test/test_artifact.py @@ -966,8 +966,8 @@ def test_visibility_setter(self): # /- 2 (private) -|- 5 (private) # 1 (private) -| \- 6 (private) # \- 3 (private) - # By changing the visibility of 4 to public, the visibility of 1 and - # 2 also changes to public + # By changing the visibility of 4 to public, the visibility of all + # should change a1 = qdb.artifact.Artifact(1) a2 = qdb.artifact.Artifact(2) a3 = qdb.artifact.Artifact(3) @@ -979,17 +979,16 @@ def test_visibility_setter(self): self.assertEqual(a1.visibility, "public") self.assertEqual(a2.visibility, "public") - self.assertEqual(a3.visibility, "private") + self.assertEqual(a3.visibility, "public") self.assertEqual(a4.visibility, "public") - self.assertEqual(a5.visibility, "private") - self.assertEqual(a6.visibility, "private") + self.assertEqual(a5.visibility, "public") + self.assertEqual(a6.visibility, "public") - # However, if we change it back to private, - # it should remain public + # Same if we go back a4.visibility = 'private' - self.assertEqual(a1.visibility, "public") - self.assertEqual(a2.visibility, "public") + self.assertEqual(a1.visibility, "private") + self.assertEqual(a2.visibility, "private") self.assertEqual(a3.visibility, "private") self.assertEqual(a4.visibility, "private") self.assertEqual(a5.visibility, "private") diff --git a/qiita_db/test/test_util.py b/qiita_db/test/test_util.py index a660d78bb..177d69fe5 100644 --- a/qiita_db/test/test_util.py +++ b/qiita_db/test/test_util.py @@ -968,89 +968,119 @@ def test_generate_study_list(self): qdb.artifact.Artifact(4).visibility = 'public' exp_info[0]['status'] = 'public' - exp_info[0]['proc_data_info'] = [{ - 'data_type': '18S', - 'algorithm': 'QIIME (Pick closed-reference OTUs)', - 'pid': 4, - 'processed_date': '2012-10-02 17:30:00', - 'params': { - 'similarity': 0.97, - 'reference_name': 'Greengenes', - 'sortmerna_e_value': 1, - 'sortmerna_max_pos': 10000, - 'threads': 1, - 'sortmerna_coverage': 0.97, - 'reference_version': '13_8'}, - 'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195', - '1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176', - '1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200', - '1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198', - '1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190', - '1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182', - '1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197', - '1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187', - '1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']}] + exp_info[0]['proc_data_info'] = [ + {'data_type': '18S', + 'algorithm': 'QIIME (Pick closed-reference OTUs)', 'pid': 4, + 'processed_date': '2012-10-02 17:30:00', + 'params': {'similarity': 0.97, 'reference_name': 'Greengenes', + 'sortmerna_e_value': 1, u'sortmerna_max_pos': 10000, + 'threads': 1, u'sortmerna_coverage': 0.97, + 'reference_version': '13_8'}, + 'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195', + '1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176', + '1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200', + '1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198', + '1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190', + '1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182', + '1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197', + '1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187', + '1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']}, + {'data_type': '18S', + 'algorithm': 'QIIME (Pick closed-reference OTUs)', 'pid': 5, + 'processed_date': '2012-10-02 17:30:00', + 'params': {'similarity': 0.97, 'reference_name': 'Greengenes', + 'sortmerna_e_value': 1, u'sortmerna_max_pos': 10000, + 'threads': 1, 'sortmerna_coverage': 0.97, + 'reference_version': '13_8'}, + 'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195', + '1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176', + '1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200', + '1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198', + '1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190', + '1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182', + '1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197', + '1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187', + '1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']}, + {'data_type': '16S', + 'algorithm': 'QIIME (Pick closed-reference OTUs)', 'pid': 6, + 'processed_date': '2012-10-02 17:30:00', + 'params': {'similarity': 0.97, 'reference_name': 'Silva', + 'sortmerna_e_value': 1, u'sortmerna_max_pos': 10000, + 'threads': 1, 'sortmerna_coverage': 0.97, + 'reference_version': 'test'}, + 'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195', + '1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176', + '1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200', + '1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198', + '1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190', + '1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182', + '1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197', + '1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187', + '1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']}] obs_info = qdb.util.generate_study_list([1, 2, 3, 4], True, public_only=True) self.assertEqual(obs_info, exp_info) - exp_info[0]['proc_data_info'].extend( - [{ - 'data_type': '18S', - 'algorithm': 'QIIME (Pick closed-reference OTUs)', - 'pid': 5, - 'processed_date': '2012-10-02 17:30:00', - 'params': { - 'similarity': 0.97, - 'reference_name': 'Greengenes', - 'sortmerna_e_value': 1, - 'sortmerna_max_pos': 10000, - 'threads': 1, - 'sortmerna_coverage': 0.97, - 'reference_version': '13_8'}, - 'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195', - '1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176', - '1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200', - '1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198', - '1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190', - '1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182', - '1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197', - '1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187', - '1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']}, { - 'data_type': '16S', - 'algorithm': 'QIIME (Pick closed-reference OTUs)', - 'pid': 6, - 'processed_date': '2012-10-02 17:30:00', - 'params': { - 'similarity': 0.97, - 'reference_name': 'Silva', - 'sortmerna_e_value': 1, - 'sortmerna_max_pos': 10000, - 'threads': 1, - 'sortmerna_coverage': 0.97, - 'reference_version': 'test'}, - 'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195', - '1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176', - '1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200', - '1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198', - '1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190', - '1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182', - '1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197', - '1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187', - '1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']}, { - 'processed_date': '2012-10-02 17:30:00', - 'pid': 7, - 'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195', - '1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176', - '1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200', - '1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198', - '1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190', - '1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182', - '1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197', - '1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187', - '1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192'], - 'data_type': '16S'}]) - + exp_info[0]['proc_data_info'] = [ + {'data_type': '18S', + 'algorithm': 'QIIME (Pick closed-reference OTUs)', 'pid': 4, + 'processed_date': '2012-10-02 17:30:00', + 'params': {'similarity': 0.97, 'reference_name': 'Greengenes', + 'sortmerna_e_value': 1, u'sortmerna_max_pos': 10000, + 'threads': 1, 'sortmerna_coverage': 0.97, + 'reference_version': '13_8'}, + 'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195', + '1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176', + '1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200', + '1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198', + '1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190', + '1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182', + '1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197', + '1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187', + '1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']}, + {'data_type': '18S', + 'algorithm': 'QIIME (Pick closed-reference OTUs)', 'pid': 5, + 'processed_date': '2012-10-02 17:30:00', + 'params': {'similarity': 0.97, 'reference_name': 'Greengenes', + 'sortmerna_e_value': 1, u'sortmerna_max_pos': 10000, + 'threads': 1, 'sortmerna_coverage': 0.97, + 'reference_version': '13_8'}, + 'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195', + '1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176', + '1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200', + '1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198', + '1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190', + '1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182', + '1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197', + '1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187', + '1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']}, + {'data_type': '16S', + 'algorithm': 'QIIME (Pick closed-reference OTUs)', 'pid': 6, + 'processed_date': '2012-10-02 17:30:00', + 'params': {'similarity': 0.97, 'reference_name': 'Silva', + 'sortmerna_e_value': 1, u'sortmerna_max_pos': 10000, + 'threads': 1, 'sortmerna_coverage': 0.97, + 'reference_version': 'test'}, + 'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195', + '1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176', + '1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200', + '1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198', + '1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190', + '1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182', + '1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197', + '1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187', + '1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192']}, + {'processed_date': '2012-10-02 17:30:00', 'pid': 7, + 'samples': ['1.SKB1.640202', '1.SKB2.640194', '1.SKB3.640195', + '1.SKB4.640189', '1.SKB5.640181', '1.SKB6.640176', + '1.SKB7.640196', '1.SKB8.640193', '1.SKB9.640200', + '1.SKD1.640179', '1.SKD2.640178', '1.SKD3.640198', + '1.SKD4.640185', '1.SKD5.640186', '1.SKD6.640190', + '1.SKD7.640191', '1.SKD8.640184', '1.SKD9.640182', + '1.SKM1.640183', '1.SKM2.640199', '1.SKM3.640197', + '1.SKM4.640180', '1.SKM5.640177', '1.SKM6.640187', + '1.SKM7.640188', '1.SKM8.640201', '1.SKM9.640192'], + 'data_type': '16S'}] obs_info = qdb.util.generate_study_list([1, 2, 3, 4], True) self.assertEqual(obs_info, exp_info) diff --git a/qiita_pet/handlers/api_proxy/tests/test_artifact.py b/qiita_pet/handlers/api_proxy/tests/test_artifact.py index fa819c96b..149d7456e 100644 --- a/qiita_pet/handlers/api_proxy/tests/test_artifact.py +++ b/qiita_pet/handlers/api_proxy/tests/test_artifact.py @@ -302,7 +302,7 @@ def test_artifact_summary_get_request(self): 'files': exp_files, 'errored_jobs': [], 'editable': True, - 'visibility': 'private', + 'visibility': 'sandbox', 'job': None, 'message': '', 'name': 'Demultiplexed 1', @@ -316,17 +316,14 @@ def test_artifact_summary_get_request(self): 'min_per_read_length_fraction': 0.75, 'barcode_type': u'golay_12'}, 'summary': None, - 'buttons': (' Submit to VAMPS'), + 'buttons': ( + ' ' + ' Submit to ' + 'VAMPS'), 'study_id': 1, 'prep_id': 1} self.assertEqual(obs, exp) diff --git a/qiita_pet/handlers/api_proxy/tests/test_prep_template.py b/qiita_pet/handlers/api_proxy/tests/test_prep_template.py index fa43db045..48133cdea 100644 --- a/qiita_pet/handlers/api_proxy/tests/test_prep_template.py +++ b/qiita_pet/handlers/api_proxy/tests/test_prep_template.py @@ -332,7 +332,7 @@ def test_prep_template_graph_get_req(self): obs = prep_template_graph_get_req(1, 'demo@microbio.me') self.assertEqual(obs['message'], '') self.assertEqual(obs['status'], 'success') - self.assertEqual(8, len(obs['node_labels'])) + self.assertEqual(11, len(obs['node_labels'])) self.assertIn(('artifact', 1, 'Raw data 1 - FASTQ'), obs['node_labels']) self.assertIn(('artifact', 2, 'Demultiplexed 1 - Demultiplexed'),