Beispiel #1
0
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
Beispiel #2
0
def recreatedb():
    db.drop_all()
    db.create_all()
    db.session.commit()
Beispiel #3
0
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!')
Beispiel #5
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()