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()
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()
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]")
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
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
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
def createdb(): """ Creates a database with all of the tables defined in your Alchemy models """ db.create_all()
def initdb(): """ Creates a database with all of the tables defined in your SQLAlchemy models """ click.echo('Initalizing the db') db.create_all()
def create_tables(): db.create_all()
def setup(self): app = create_app('appname.settings.DevConfig', env='dev') self.app = app.test_client() db.app = app db.create_all()
def setup(self): app = create_app("appname.settings.DevConfig", env="dev") self.app = app.test_client() db.app = app db.create_all()