示例#1
0
    def test_add_identifier(self, mock_identifier):
        testWork = Work()
        mock_id = MagicMock()
        mock_id.value = 'id1'
        mock_identifier.returnOrInsert.return_value = mock_id

        testID = testWork.addIdentifier('id1')
        self.assertEqual(testID.value, 'id1')
示例#2
0
 def test_add_identifier_err(self, mock_identifier):
     testWork = Work()
     mock_identifier.returnOrInsert.side_effect = DataError('test error')
     testID = testWork.addIdentifier('id1')
     self.assertEqual(testID, None)