Beispiel #1
0
def db():
    from service import db
    with app.app_context():
        db.create_all()
        yield db
        db.drop_all()
        db.session.commit()
def client():
    ## Setup for each test ##
    app.config['TESTING'] = True
    app.config[
        'SQLALCHEMY_DATABASE_URI'] = 'postgresql://*****:*****@testdb:5432/mytestdb'

    client = app.test_client()

    with app.app_context():
        db.create_all()

    yield client

    ## Teardown for each test ##
    with app.app_context():
        db.session.close()
        db.drop_all()
Beispiel #3
0
def drop():
    "Drops all database tables"
    if prompt_bool("Are you sure you want to lose all your data"):
        db.drop_all()
Beispiel #4
0
def recreate_db():
    db.drop_all()
    db.create_all()
    db.session.commit()
Beispiel #5
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()
Beispiel #6
0
def drop():
    "Drops All Database Tables"
    if prompt_bool('Are you sure you want to drop all tables', default=False):
        db.drop_all()
Beispiel #7
0
    def tearDown(self):
        ''' Tear down the database. '''

        db.session.remove()
        db.drop_all()
Beispiel #8
0
def drop_db():
    db.drop_all()
    db.session.commit()
 def tearDown(self):
     db.session.remove()
     db.drop_all()