Example #1
0
 def test_with_community(self):
     metadata = assemble_metadata(self.response, 'Chameleon')
     self.assertEqual(metadata['title'], self.response['title'])
     self.assertEqual(metadata['creators'][0]['name'],
                      self.response['author'])
     self.assertEqual(metadata['description'], self.response['description'])
     self.assertEqual(metadata['upload_type'], 'publication')
     self.assertEqual(metadata['publication_type'], 'workingpaper')
Example #2
0
 def test_success(self):
     metadata = assemble_metadata(self.response, None)
     self.assertEqual(metadata['title'], self.response['title'])
     self.assertEqual(metadata['creators'][0]['name'],
                      self.response['author'])
     self.assertEqual(metadata['description'], self.response['description'])
     self.assertEqual(metadata['upload_type'], 'publication')
     self.assertEqual(metadata['publication_type'], 'workingpaper')
Example #3
0
 def test_many_authors(self):
     self.response['author'] = 'Person One,Person Two,Person Three'
     self.response['affiliation'] = 'Place one,Place two,Place three'
     combined = [{
         'name': 'Person One',
         'affiliation': 'Place one'
     }, {
         'name': 'Person Two',
         'affiliation': 'Place two'
     }, {
         'name': 'Person Three',
         'affiliation': 'Place three'
     }]
     data = assemble_metadata(self.response, None)
     self.assertEqual(data['creators'], combined)
Example #4
0
 def test_no_title(self):
     self.response.pop('title')
     with self.assertRaises(UserMistake):
         assemble_metadata(self.response, None)
Example #5
0
 def test_many_authors_one_place(self):
     self.response['author'] = 'Person One,Person Two,Person Three'
     with self.assertRaises(UserMistake):
         data = assemble_metadata(self.response, None)
Example #6
0
 def test_short_description(self):
     self.response['description'] = 'j'
     with self.assertRaises(UserMistake):
         assemble_metadata(self.response, None)
Example #7
0
 def test_short_authors(self):
     self.response['author'] = 'j'
     with self.assertRaises(UserMistake):
         assemble_metadata(self.response, None)
Example #8
0
 def test_short_title(self):
     self.response['title'] = 'j'
     with self.assertRaises(UserMistake):
         assemble_metadata(self.response, None)
Example #9
0
 def test_no_description(self):
     self.response.pop('description')
     with self.assertRaises(UserMistake):
         assemble_metadata(self.response, None)
Example #10
0
 def test_no_authors(self):
     self.response.pop('author')
     with self.assertRaises(UserMistake):
         assemble_metadata(self.response, None)