Esempio n. 1
0
 def test_lookup_work_by_instance(self, mock_iden):
     mock_session = MagicMock()
     mock_session.query().filter().one.return_value = (1, )
     mock_session.query().get.return_value = 'test_work'
     mock_iden.getByIdentifier.side_effect = [None, 'test_id']
     testID = Work.lookupWork(mock_session, ['id1'], None)
     self.assertEqual(testID, 'test_work')
Esempio n. 2
0
 def test_lookup_work_not_found(self, mock_iden):
     mock_session = MagicMock()
     mock_session.query().get().work.uuid = 'test_uuid'
     mock_iden.getByIdentifier.side_effect = [None, None]
     testID = Work.lookupWork(mock_session, ['id1'], None)
     self.assertEqual(testID, None)
Esempio n. 3
0
 def test_lookup_work(self, mock_iden):
     mock_session = MagicMock()
     mock_session.query().get.return_value = 'test_work'
     mock_iden.getByIdentifier.return_value = 'test_id'
     testID = Work.lookupWork(mock_session, ['id1'], None)
     self.assertEqual(testID, 'test_work')
Esempio n. 4
0
 def test_lookup_uuid(self, mock_get_uuid):
     testID = Work.lookupWork('session', ['id1'], {
         'type': 'uuid',
         'identifier': 'test_uuid'
     })
     self.assertEqual(testID, 'test_id')