class InitializationTestCase(unittest.TestCase): def setUp(self): app = flask.Flask(__name__) app.config['COUCHDB_DATABASE'] = 'test_db_2' app.config['TESTING'] = True self.app = app def tearDown(self): del self.couchdb.server[self.app.config['COUCHDB_DATABASE']] def test_connection_manager(self): self.app.config['COUCHDB_KEEPALIVE'] = 20 self.couchdb = CouchDBKit(self.app) server = self.couchdb.server self.assertEqual(server.res.client._manager.max_conn, self.app.config['COUCHDB_KEEPALIVE']) def test_init_db(self): self.couchdb = CouchDBKit(self.app) self.assertTrue(self.couchdb.server.all_dbs().index('test_db_2')) def test_late_initialization(self): self.couchdb = CouchDBKit() self.couchdb.init_app(self.app) self.assertTrue(self.couchdb.server.all_dbs().index('test_db_2'))
class InitializationTestCase(unittest.TestCase): def setUp(self): app = flask.Flask(__name__) app.config['COUCHDB_DATABASE'] = 'test_db_2' app.config['TESTING'] = True self.app = app def tearDown(self): del self.couchdb.server[self.app.config['COUCHDB_DATABASE']] def test_init_db(self): self.couchdb = CouchDBKit(self.app) self.assertTrue(self.couchdb.server.all_dbs().index('test_db_2')) def test_late_initialization(self): self.couchdb = CouchDBKit() self.couchdb.init_app(self.app) self.assertTrue(self.couchdb.server.all_dbs().index('test_db_2'))