def initialize_db():
    """ Initializes a new database """
    from flask_app import init_security
    from flask_app.database import create_db
    # Initialize database context
    init_security()
    # Drop and create tables
    create_db()
def client(request):
    """ Creates the test client """
    client = app.test_client()
    app.config.from_pyfile("config/testing.py")

    # Update celery app config for testing
    current_app.conf.update(app.config)

    # Add email and password as globals for easy ref.
    global EMAIL
    EMAIL = app.config["TEST_EMAIL"]
    global PASSWORD
    PASSWORD = app.config["TEST_PASSWORD"]

    # Initialize db and add a test user
    create_db()
    user_datastore.create_user(email=EMAIL, password=PASSWORD)
    db.session.commit()

    return client