diff --git a/qiita_pet/handlers/study_handlers/edit_handlers.py b/qiita_pet/handlers/study_handlers/edit_handlers.py index 8d83a1f73..d438796e2 100644 --- a/qiita_pet/handlers/study_handlers/edit_handlers.py +++ b/qiita_pet/handlers/study_handlers/edit_handlers.py @@ -289,6 +289,8 @@ def post(self, study=None): dois = dois[0].split(',') # Make sure that we strip the spaces from the pubmed ids the_study.publications = [(doi.strip(), None) for doi in dois] + elif the_study.publications != '': + the_study.publications = [] self.render('index.html', message=msg, level='success') diff --git a/qiita_pet/handlers/study_handlers/tests/test_edit_handlers.py b/qiita_pet/handlers/study_handlers/tests/test_edit_handlers.py index efe389966..0caa9d345 100644 --- a/qiita_pet/handlers/study_handlers/tests/test_edit_handlers.py +++ b/qiita_pet/handlers/study_handlers/tests/test_edit_handlers.py @@ -107,6 +107,32 @@ def test_post_edit(self): self.assertTrue(check_count('qiita.study', study_count_before)) self.assertEqual(study.title, 'New title - test post edit') + def test_post_edit_blank_doi(self): + study_count_before = get_count('qiita.study') + study = Study(1) + study_info = study.info + + post_data = { + 'new_people_names': [], + 'new_people_emails': [], + 'new_people_affiliations': [], + 'new_people_addresses': [], + 'new_people_phones': [], + 'study_title': 'New title - test post edit', + 'study_alias': study_info['study_alias'], + 'publications_doi': '', + 'study_abstract': study_info['study_abstract'], + 'study_description': study_info['study_description'], + 'principal_investigator': study_info['principal_investigator'].id, + 'lab_person': study_info['lab_person'].id} + + self.post('/study/edit/1', post_data) + + # Check that the study was updated + self.assertTrue(check_count('qiita.study', study_count_before)) + self.assertEqual(study.title, 'New title - test post edit') + self.assertEqual(study.publications, []) + class TestCreateStudyAJAX(TestHandlerBase): def test_get(self):