def __init__(self): """Method initializing the class.""" # Setup database variables self.url = URL self.engine = TEST_ENGINE # Get configuration self.config = configuration.Config() # Validate the configuration unittest_setup.ready() # Validate the database self.validate()
"""Testing function id_agent_exists.""" # Testing with known good value expected = True result = db_agent.id_agent_exists(self.good_id) self.assertEqual(result, expected) # Testing with known bad value expected = False result = db_agent.id_agent_exists('bogus') self.assertEqual(result, expected) def test_idx_agent_exists(self): """Testing function idx_agent_exists.""" # Testing with known good value expected = True result = db_agent.idx_agent_exists(self.idx_agent_good) self.assertEqual(result, expected) # Testing with known bad value expected = False result = db_agent.idx_agent_exists(None) self.assertEqual(result, expected) if __name__ == '__main__': # Test the environment variables unittest_setup.ready() # Do the unit test unittest.main()