Beispiel #1
0
def initialize_database():
    with current_app.app_context():
        db.create_all()
    yield db
    with current_app.app_context():
        try:
            db.session.commit()
        except Exception as exception:
            app_logger.warning(f"Exception occurred: {exception}")
            pass
        db.session.remove()
        db.drop_all()
Beispiel #2
0
def drop_and_rebuild_sql():
    app = create_app()
    context = app.app_context()
    context.push()

    # define working database
    working_database = config.DATABASE_NAME

    # drop working database
    print(f"Dropping database: {working_database}")
    db.drop_all()

    # recreate working database
    print(f"Creating database: {working_database}")
    db.create_all()

    context.pop()
Beispiel #3
0
from app.server import db
from app.server.api.models.Tournament import Tournament
from app.server.api.models.TournametsToObjects import TournamentsToObject
from app.server.api.models.user import User
from app.server.api.models.contestant import Contestant
from app.server.api.models.team import Team
from app.server.api.models import *


db.drop_all()
db.create_all()

db.session.commit()
Beispiel #4
0
 def tearDown(self):
     CommonTestWithDatabaseSupport.tearDownClass()
     db.session.remove()
     db.drop_all()
     app.config[
         'SQLALCHEMY_DATABASE_URI'] = config.Flask.SQLALCHEMY_DATABASE_URI
Beispiel #5
0
 def setUp(self):
     app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
     db.drop_all()
     db.create_all()
 def tearDown(self):
     db.session.remove()
     db.drop_all()
Beispiel #7
0
def drop_db():
    """Drops the db tables."""
    db.drop_all()
Beispiel #8
0
 def tearDownClass(cls):
     db.session.remove()
     db.drop_all()
Beispiel #9
0
 def setUp(self):
     db.drop_all()
     db.create_all()
 def tearDownClass(cls):
     db.session.remove()
     db.drop_all()
 def setUp(self):
     db.drop_all()
     db.create_all()
Beispiel #12
0
 def tearDown(self):
     db.session.remove()
     db.drop_all()
     super(BaseTestCase, self).tearDown()