Example #1
0
 def test_authority_query_single_error(self):
     mock_session = MagicMock()
     mock_session.query().filter().one_or_none.return_value = None
     testAgent = Agent(mock_session)
     testAgent.viaf = 999999999
     testAgent.lcnaf = 999999999
     noAgent = testAgent.authorityQuery()
     self.assertEqual(noAgent, None)
Example #2
0
 def test_authority_query_success(self):
     mock_session = MagicMock()
     mock_session.query().filter().one_or_none.return_value = 'mockAgent'
     testAgent = Agent(mock_session)
     testAgent.viaf = 999999999
     testAgent.lcnaf = 999999999
     foundAgent = testAgent.authorityQuery()
     self.assertEqual(foundAgent, 'mockAgent')
Example #3
0
 def test_authority_query_multiple_error(self):
     mock_session = MagicMock()
     mock_session.query()\
         .filter().one_or_none.side_effect = MultipleResultsFound
     mock_session.query().filter().first.return_value = 'firstMatch'
     testAgent = Agent(mock_session)
     testAgent.viaf = 999999999
     testAgent.lcnaf = 999999999
     firstAgent = testAgent.authorityQuery()
     self.assertEqual(firstAgent, 'firstMatch')