def setUpClass(self): peeweeutils.get_db_from_config( { 'database.name': ':memory:', 'database.type': 'sqlite' }, test_db) TestModel.create_table() obj = TestModel(name='test', message='this is a test model') obj.save()
def initialize_models(config): peeweeutils.get_db_from_config(config, db) # Create all of the model tables with silent failures (in case the tables # already exist) User.create_table(True) Registration.create_table(True) Metric.create_table(True) Event.create_table(True) # The first user in the DB will be the admin user. Ignore errors. from bakula.security import iam iam.create('admin', config.get('admin_password', 'secret'))
def setUpClass(self): peeweeutils.get_db_from_config({"database.name": ":memory:", "database.type": "sqlite"}, test_db) TestModel.create_table() obj = TestModel(name="test", message="this is a test model") obj.save()