def app(): """ Setup our flask test app, this only gets executed once. :return: Flask app """ db_uri = '{0}_test'.format(settings.SQLALCHEMY_DATABASE_URI) params = { 'DEBUG': False, 'TESTING': True, 'WTF_CSRF_ENABLED': False, 'SQLALCHEMY_DATABASE_URI': db_uri } _app = create_app(settings_override=params) # Establish an application context before running the tests. ctx = _app.app_context() ctx.push() yield _app ctx.pop()
import os from datetime import datetime from faker import Faker from dataweb.app import create_app from dataweb.extensions import db from dataweb.blueprints.user.models import User, File ''' from dataweb.blueprints.billing.models.invoice import Invoice from dataweb.blueprints.bet.models.bet import Bet from dataweb.blueprints.bet.models.dice import roll ''' # Create an app context for the database connection. app = create_app() db.app = app fake = Faker() def _log_status(count, model_label): """ Log the output of how many records were created. :param count: Amount created :type count: int :param model_label: Name of the model :type model_label: str :return: None """