Skip to content

Commit

Permalink
Merge ba2de84 into c8fa007
Browse files Browse the repository at this point in the history
  • Loading branch information
antgonza committed Nov 7, 2016
2 parents c8fa007 + ba2de84 commit d6edba1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions qiita_pet/handlers/study_handlers/edit_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
26 changes: 26 additions & 0 deletions qiita_pet/handlers/study_handlers/tests/test_edit_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit d6edba1

Please sign in to comment.