How to use the dockerflow.flask.checks.check_database_connected function in dockerflow

To help you get started, we’ve selected a few dockerflow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla-services / python-dockerflow / tests / flask / test_flask.py View on Github external
def test_db_check_sqlalchemy_error(mocker, db):
    engine_connect = mocker.patch.object(db.engine, "connect")
    engine_connect.side_effect = SQLAlchemyError
    errors = checks.check_database_connected(db)
    assert len(errors) == 1
    assert errors[0].id == health.ERROR_SQLALCHEMY_EXCEPTION
github mozilla-services / python-dockerflow / tests / flask / test_flask.py View on Github external
def test_db_check_dbapi_error(mocker, db):
    exception = DBAPIError.instance("", [], Exception(), Exception)
    engine_connect = mocker.patch.object(db.engine, "connect")
    engine_connect.side_effect = exception
    errors = checks.check_database_connected(db)
    assert len(errors) == 1
    assert errors[0].id == health.ERROR_DB_API_EXCEPTION
github mozilla-services / python-dockerflow / tests / flask / test_flask.py View on Github external
def test_db_check_success(db):
    errors = checks.check_database_connected(db)
    assert errors == []