Exemplo n.º 1
0
def client(app):
    with app.test_client() as client:
        _db.app = app
        _db.create_all()
        yield client
        _db.session.rollback()
        _db.drop_all()
Exemplo n.º 2
0
def drop():
    """Drops database tables"""
    if prompt_bool("Are you sure you want to lose all your data"):
        from application.models.logic import Logic
        db.metadata.drop_all(db.engine, tables=[Logic.__table__])
        db.drop_all()
        redis.flushall()
Exemplo n.º 3
0
def refresh():
    """Drops database, recreates it and inserts fake data in tables and redis"""
    from application.models.logic import Logic
    db.metadata.drop_all(db.engine, tables=[Logic.__table__])
    db.drop_all()
    redis.flushall()
    create()
    fake()
Exemplo n.º 4
0
def my_teardown(obj):
    """Call this function from tearDown as:

    def tearDown(self):
        my_teardown(self)

    """
    db.session.remove()
    db.drop_all()
    obj.app_context.pop()
Exemplo n.º 5
0
def init_db():
    db.create_all()
    db.session.add(User(
        username="******", password=guard.hash_password("admin"), roles="admin"
    ))
    db.session.add(PortfolioImage(
        title="Test", category="portrait", client="Der Boi"
    ))
    db.session.add(PortfolioVideo(
        title="Test", category="aftermovie", client="Der Boi", video="ilusrhgiur"
    ))
    db.session.commit()

    yield db

    db.drop_all()
Exemplo n.º 6
0
def drop_db():
    """
    Drop Database
    """
    db.drop_all()
Exemplo n.º 7
0
def dropall():
    """Drops all database tables"""
    if prompt_bool("Are you sure ? You will lose all your data !"):
        db.drop_all()
 def teardown():
     _db.drop_all()
Exemplo n.º 9
0
def drop_all():
    if prompt_bool("Are you sure? You will lose all your data!"):
        db.drop_all()
Exemplo n.º 10
0
 def teardown():
     _db.drop_all()
     os.unlink(app.config["TEST_DB"])
Exemplo n.º 11
0
def drop():
    """Drops database tables"""
    if prompt_bool("Are you sure you want to lose all your data"):
        db.drop_all()
        redis.flushdb()
 def tearDownClass(cls):
     with cls.app.app_context():
         db.drop_all()
         db.session.remove()
     cls.app.extensions['redis'].flushdb()