-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
16 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,8 +150,7 @@ def setUp(self): | |
"study_abstract": "Exploring how a high fat diet changes the " | ||
"gut microbiome", | ||
"principal_investigator_id": qdb.study.StudyPerson(3), | ||
"lab_person_id": qdb.study.StudyPerson(1), | ||
'specimen_id_column': None | ||
"lab_person_id": qdb.study.StudyPerson(1) | ||
} | ||
|
||
self.infoexp = { | ||
|
@@ -165,7 +164,6 @@ def setUp(self): | |
"gut microbiome", | ||
"principal_investigator": qdb.study.StudyPerson(3), | ||
"lab_person": qdb.study.StudyPerson(1), | ||
'specimen_id_column': None, | ||
'public_raw_download': False | ||
} | ||
|
||
|
@@ -193,8 +191,7 @@ def setUp(self): | |
'study_description': 'Analysis of the Cannabis Plant Microbiome', | ||
'study_alias': 'Cannabis Soils', | ||
'most_recent_contact': datetime(2014, 5, 19, 16, 11), | ||
'lab_person': qdb.study.StudyPerson(1), | ||
'specimen_id_column': None} | ||
'lab_person': qdb.study.StudyPerson(1)} | ||
|
||
def tearDown(self): | ||
qiita_config.portal = self.portal | ||
|
@@ -251,8 +248,7 @@ def test_get_info(self): | |
'Soils', | ||
'ebi_submission_status': 'submitted', | ||
'ebi_study_accession': 'EBI123456-BB', | ||
'autoloaded': False, | ||
'specimen_id_column': None} | ||
'autoloaded': False} | ||
self.assertDictEqual(obs, exp) | ||
|
||
# Test get specific keys for single study | ||
|
@@ -446,8 +442,7 @@ def test_create_study_min_data(self): | |
'study_alias': 'FCM', | ||
'most_recent_contact': None, | ||
'lab_person': qdb.study.StudyPerson(1), | ||
'notes': '', | ||
'specimen_id_column': None} | ||
'notes': ''} | ||
self.assertEqual(obs_info, exp) | ||
# Check the timestamp separately, since it is set by the database | ||
# to the microsecond, and we can't predict it a priori | ||
|
@@ -529,8 +524,7 @@ def test_create_study_all_data(self): | |
'study_alias': 'FCM', | ||
'most_recent_contact': None, | ||
'lab_person': qdb.study.StudyPerson(1), | ||
'notes': 'an analysis was performed \n here and \n here', | ||
'specimen_id_column': None} | ||
'notes': 'an analysis was performed \n here and \n here'} | ||
self.assertEqual(obs.info, exp) | ||
self.assertEqual(obs.shared_with, []) | ||
self.assertEqual(obs.publications, []) | ||
|
@@ -912,31 +906,6 @@ def test_study_tags(self): | |
self.assertEqual(study.tags, []) | ||
self.assertEqual(message, '') | ||
|
||
def test_specimen_id_column_get_set(self): | ||
self.assertEqual(self.study.specimen_id_column, None) | ||
self.study.specimen_id_column = 'anonymized_name' | ||
self.assertEqual(self.study.specimen_id_column, 'anonymized_name') | ||
self.study.specimen_id_column = None | ||
self.assertEqual(self.study.specimen_id_column, None) | ||
|
||
def test_specimen_id_column_not_unique(self): | ||
with self.assertRaises(qdb.exceptions.QiitaDBColumnError): | ||
self.study.specimen_id_column = 'dna_extracted' | ||
|
||
def test_specimen_id_column_doesnt_exist(self): | ||
with self.assertRaises(qdb.exceptions.QiitaDBLookupError): | ||
self.study.specimen_id_column = 'foo' | ||
|
||
def test_specimen_id_column_no_sample_information(self): | ||
empty = qdb.study.Study.create( | ||
qdb.user.User('[email protected]'), "Fried duck microbiome", | ||
self.info) | ||
with self.assertRaises(qdb.exceptions.QiitaDBLookupError): | ||
empty.specimen_id_column = 'foo' | ||
|
||
# cleaning up the created study | ||
qdb.study.Study.delete(empty._id) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,7 +73,7 @@ def test_study_get_req(self): | |
'rhizospheres from the same location at different time ' | ||
'points in the plant lifecycle.'), | ||
'status': 'private', 'spatial_series': False, | ||
'specimen_id_column': None, 'public_raw_download': False, | ||
'public_raw_download': False, | ||
'study_description': ( | ||
'Analysis of the Cannabis Plant Microbiome'), | ||
'shared_with': ['[email protected]'], 'publication_doi': [ | ||
|
@@ -127,7 +127,7 @@ def test_study_get_req(self): | |
'email': '[email protected]'}, 'study_alias': 'FCM', | ||
'study_id': new_study.id, 'notes': '', | ||
'most_recent_contact': datetime(2015, 5, 19, 16, 11), | ||
'ebi_study_accession': None, 'specimen_id_column': None, | ||
'ebi_study_accession': None, | ||
'study_title': 'Some New Study for test'}, 'message': '', | ||
'editable': True} | ||
self.assertCountEqual(obs, exp) | ||
|
@@ -465,38 +465,6 @@ def test_study_patch_request_errors(self): | |
'path parameter'), 'status': 'error'} | ||
self.assertEqual(obs, exp) | ||
|
||
def test_study_patch_request_specimen_id(self): | ||
obs = study_patch_request('[email protected]', 1, | ||
'replace', '/specimen_id_column', | ||
'anonymized_name') | ||
exp = {'status': 'success', 'message': 'Successfully updated ' | ||
'specimen id column'} | ||
self.assertEqual(obs, exp) | ||
|
||
obs = study_patch_request('[email protected]', 1, | ||
'replace', '/specimen_id_column', | ||
'host_subject_id') | ||
exp = {'status': 'success', 'message': 'Successfully updated ' | ||
'specimen id column'} | ||
self.assertEqual(obs, exp) | ||
|
||
qdb.study.Study(1).specimen_id_column = None | ||
|
||
def test_study_patch_request_specimen_id_errors(self): | ||
obs = study_patch_request('[email protected]', 1, | ||
'replace', '/specimen_id_column', | ||
'taxon_id') | ||
exp = {'status': 'error', 'message': 'The category does not contain' | ||
' unique values.'} | ||
self.assertEqual(obs, exp) | ||
|
||
obs = study_patch_request('[email protected]', 1, | ||
'replace', '/specimen_id_column', | ||
'bleep_bloop') | ||
exp = {'status': 'error', 'message': "Category 'bleep_bloop' is not" | ||
" present in the sample information."} | ||
self.assertEqual(obs, exp) | ||
|
||
def test_study_patch_request_toggle_public_raw_download(self): | ||
study_id = 1 | ||
study = qdb.study.Study(study_id) | ||
|
@@ -508,14 +476,6 @@ def test_study_patch_request_toggle_public_raw_download(self): | |
self.assertEqual(obs, exp) | ||
self.assertTrue(study.public_raw_download) | ||
|
||
obs = study_patch_request('[email protected]', study_id, | ||
'replace', '/specimen_id_column', | ||
'host_subject_id') | ||
exp = {'status': 'error', | ||
'message': 'User does not have access to study'} | ||
self.assertEqual(obs, exp) | ||
self.assertTrue(study.public_raw_download) | ||
|
||
# returning to default status | ||
study.public_raw_download = False | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.