Exemplo n.º 1
0
def db():
    from service import db
    with app.app_context():
        db.create_all()
        yield db
        db.drop_all()
        db.session.commit()
Exemplo n.º 2
0
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()
Exemplo n.º 3
0
def drop():
    "Drops all database tables"
    if prompt_bool("Are you sure you want to lose all your data"):
        db.drop_all()
Exemplo n.º 4
0
def recreate_db():
    db.drop_all()
    db.create_all()
    db.session.commit()
Exemplo n.º 5
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()
Exemplo n.º 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()
Exemplo n.º 7
0
    def tearDown(self):
        ''' Tear down the database. '''

        db.session.remove()
        db.drop_all()
Exemplo n.º 8
0
def drop_db():
    db.drop_all()
    db.session.commit()
Exemplo n.º 9
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()