def test_invalid_database_type(self): config = {'database': {'type': 'barrydb', 'user': '******', 'name': ':memory:'}} app = bottle.Bottle() app.config.load_dict(config) with self.assertRaises(RuntimeError): peeweeutils.get_db_from_config(config)
def test_invalid_database_type(self): config = { 'database': { 'type': 'barrydb', 'user': '******', 'name': ':memory:' } } app = bottle.Bottle() app.config.load_dict(config) with self.assertRaises(RuntimeError): peeweeutils.get_db_from_config(config)
def test_valid(self): config = {'database': {'type': 'sqlite', 'user': '******', 'name': ':memory:'}} app = bottle.Bottle() app.config.load_dict(config) db = peeweeutils.get_db_from_config(config) self.assertEquals(type(db), SqliteDatabase)
def test_valid(self): config = { 'database': { 'type': 'sqlite', 'user': '******', 'name': ':memory:' } } app = bottle.Bottle() app.config.load_dict(config) db = peeweeutils.get_db_from_config(config) self.assertEquals(type(db), SqliteDatabase)
def test_no_config(self): with self.assertRaises(RuntimeError): peeweeutils.get_db_from_config(None)