Example #1
0
def resetdb():
    """ Drops the tables & loads seed data
    """
    actually_drop_tables()
    db.create_all()
    if env == 'dev':
        # If you get a bunch of models, it might make sense to specify these
        seed_data()
Example #2
0
 def setup(self):
     app = create_app('appname.settings.DevConfig', env='dev')
     self.app = app.test_client()
     db.app = app
     db.create_all()
     admin = User('admin', 'supersafepassword')
     db.session.add(admin)
     db.session.commit()
Example #3
0
 def setup(self):
     app = create_app('appname.settings.DevConfig', env='dev')
     self.app = app.test_client()
     db.app = app
     db.create_all()
     admin = User('admin', 'supersafepassword')
     db.session.add(admin)
     db.session.commit()
Example #4
0
def resetdb():
    """ Drops the tables & loads seed data
    """
    actually_drop_tables()
    db.create_all()
    if env == 'dev':
        # If you get a bunch of models, it might make sense to specify these as
        # fixtures or maintain a development DB sqllite file.
        default_user = User("*****@*****.**", "test", admin=False)
        db.session.add(default_user)
        click.echo("Added [email protected]")
        admin = User("*****@*****.**",
                     "admin",
                     admin=True,
                     email_confirmed=True)
        db.session.add(admin)
        click.echo("Added [email protected]")
Example #5
0
def testapp(request):
    app = create_app('appname.settings.TestConfig', env='dev')
    client = app.test_client()

    db.app = app
    db.create_all()

    if getattr(request.module, "create_user", True):
        admin = User('admin', 'supersafepassword')
        db.session.add(admin)
        db.session.commit()

    def teardown():
        db.session.remove()
        db.drop_all()

    request.addfinalizer(teardown)

    return client
Example #6
0
def testapp(request):
    app = create_app('appname.settings.Config')
    app.test_client_class = TestClient
    app.response_class = JSONResponse
    # client = app.test_client()

    db.app = app
    setup_db(app, db)
    db.create_all()
    update_perms(db)

    def teardown():
        with app.app_context():
            db.session.remove()
            db.drop_all()

    request.addfinalizer(teardown)

    return app
Example #7
0
def testapp(request):
    app = create_app('appname.settings.TestConfig')
    client = app.test_client()

    db.app = app
    db.create_all()

    if getattr(request.module, "create_user", True):
        admin = User('*****@*****.**', 'supersafepassword', admin=True)
        user = User('*****@*****.**', 'safepassword')
        db.session.add_all([admin, user])
        db.session.commit()

    def teardown():
        db.session.remove()
        db.drop_all()

    request.addfinalizer(teardown)

    return client
Example #8
0
def createdb():
    """ Creates a database with all of the tables defined in
        your Alchemy models
    """

    db.create_all()
Example #9
0
def initdb():
    """ Creates a database with all of the tables defined in
        your SQLAlchemy models
    """
    click.echo('Initalizing the db')
    db.create_all()
Example #10
0
def createdb():
    """ Creates a database with all of the tables defined in
        your Alchemy models
    """

    db.create_all()
Example #11
0
def create_tables():
    db.create_all()
Example #12
0
 def setup(self):
     app = create_app('appname.settings.DevConfig', env='dev')
     self.app = app.test_client()
     db.app = app
     db.create_all()
Example #13
0
 def setup(self):
     app = create_app("appname.settings.DevConfig", env="dev")
     self.app = app.test_client()
     db.app = app
     db.create_all()