示例#1
0
 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()
示例#2
0
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'))
示例#3
0
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'))
示例#4
0
 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()