class TestConnection(TestCase): def __init__(self, obj): super(TestCase, self).__init__(obj) self.db_conn = None self.conn = None def setUp(self): self.conn = Connection(CityHallDbFactory(cityhall_settings)) self.db_conn = self.conn.db_connection def test_create_env(self): self.conn.connect() self.conn.create_default_env() self.assertIsInstance(self.db_conn.valsTable, list) self.assertIsInstance(self.db_conn.authTable, list) def test_open_required(self): authenticate = self.conn.authenticate('cityhall', '') self.assertTrue(authenticate is None) self.conn.connect() self.conn.create_default_env() self.assertTrue(self.conn.authenticate('cityhall', '')) def test_get_auth(self): self.conn.connect() self.conn.create_default_env() auth = self.conn.get_auth('cityhall', '') self.assertTrue(auth is not None)