Exemplo n.º 1
0
 def publications_tests(self):
     auto_fields = {
         "copo.publication.title": "Test Title",
         "copo.publication.authorList": "Author1 T1,Author2 T2,Author3 T3", "": "",
         "copo.publication.doi": "12345", "copo.publication.pubMedID": "12345",
         "copo.publication.status.annotationValue": "PubMed - indexed for MEDLINE",
         "copo.publication.status.termSource": "xyz", "copo.publication.status.termAccession": "xyz",
         "copo.publication.created_on": "01:01:2000", "copo.publication.comments": "no comments"}
     auto_fields = json.dumps(auto_fields)
     task = 'save'
     # set session variable
     s = self.client.session
     s['profile_id'] = str(self.profile_id)
     s.save()
     # call view
     response = self.client.post(reverse('copo:edit_publication'),
                                 {'auto_fields': auto_fields, 'task': task})
     # check responses
     plist = Publication(self.profile_id).get_all_pubs_in_profile()
     self.assertEqual(plist.count(), 1, 'Wrong number of Publications found, should be one.')
     self.assertEqual(response.status_code, 200, 'Publications test failed to return status 200.')