def db(app): """Create database for the tests.""" _db.app = app with app.app_context(): _db.create_all() yield _db # Explicitly close DB connection _db.session.close() _db.drop_all()
def drop_db(): """Menghapus table""" db.drop_all()
def drop_db(): """Drops the db tables.""" db.drop_all()
def create_db(): db.drop_all() db.create_all() db.session.commit()
def tearDown(self): db.session.remove() db.drop_all()
def delete_db(): """Drops database.""" db.drop_all()
def drop_db(): """Drops the db tables.""" click.echo('Dropping database tables...') db.drop_all()
def drop_db(): db.drop_all()
def tearDown(self): db.session.remove() db.drop_all(bind='agwallet')
def init_db(): """ Initialize the database.""" db.drop_all() db.create_all() create_users()
from flask_testing import TestCase from project.server import app, db class BaseTestCase(TestCase): """ Base Tests """ def create_app(self): app.config.from_object('project.server.config.TestingConfig') return app def setUp(self): db.create_all() db.session.commit() def tearDown(self): db.session.remove() db.drop_all()