コード例 #1
0
def client():
    app = create_app("testing")
    app.config['test_data'] = generate_fake_data()
    with app.test_client() as client:

        yield client

        @app.teardown_appcontext
        def delete_test_data_after(exception=None):
            logging.debug('Shutting down the test.')
            test_user_data = client.application.config['test_data']
            delete_test_user(username=test_user_data['username'])
コード例 #2
0
def client():
    app = create_app("testing")
    app.config['test_data'] = generate_fake_data()
    with app.test_client() as client:
        yield client

        @app.teardown_appcontext
        def delete_test_data(exception=None):
            logging.debug('Shutting down the test.')
            test_user_data = client.application.config['test_data']
            UserDeleteUrl = (
                f"http://{BACKEND_SERVICE_NAME}:{BACKEND_SERVICE_PORT}/api/"
                f"users/{test_user_data['username']}")
            requests.delete(UserDeleteUrl)
コード例 #3
0
from flask_frontend import create_app

app = create_app("development")
# app = create_app("testing")

if __name__ == "__main__":
    app.run(
        host="0.0.0.0",
        port=5000,
        debug=True,
        use_debugger=False,
        use_reloader=False,
        passthrough_errors=True,
    )
コード例 #4
0
def test_config():
    """
    Test flask_frontend "testing" config
    """
    app = create_app("testing")
    assert app.config["TESTING"] == True  # noqa