def client(): BASE_DIR = Path(__file__).resolve().parent.parent app.config["TESTING"] = True app.config["DATABASE"] = BASE_DIR.joinpath(TEST_DB) app.config["SQLALCHEMY_DATABASE_URI"] = f"sqlite:///{BASE_DIR.joinpath(TEST_DB)}" db.create_all() # setup yield app.test_client() # tests run here db.drop_all() # teardown
def recreatedb(): db.drop_all() db.create_all() db.session.commit()
def dropdb(): if prompt_bool("Are you sure you want to delete the database?"): db.drop_all() print("Dropped the database")
def create_db(): db.drop_all() db.create_all() db.session.commit() print('Database created!')
def tearDown(self): db.session.remove() db.drop_all()