How to use the dockerflow.django.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 / django / test_django.py View on Github external
def test_check_database_connected_unsuable(mocker):
    mocker.patch("django.db.connection.is_usable", return_value=False)
    errors = checks.check_database_connected([])
    assert len(errors) == 1
    assert errors[0].id == health.ERROR_UNUSABLE_DATABASE
github mozilla-services / python-dockerflow / tests / django / test_django.py View on Github external
def test_check_database_connected_success(mocker):
    errors = checks.check_database_connected([])
    assert errors == []
github mozilla-services / python-dockerflow / tests / django / test_django.py View on Github external
def test_check_database_connected_cannot_connect(mocker):
    ensure_connection = mocker.patch("django.db.connection.ensure_connection")
    ensure_connection.side_effect = OperationalError
    errors = checks.check_database_connected([])
    assert len(errors) == 1
    assert errors[0].id == health.ERROR_CANNOT_CONNECT_DATABASE
github mozilla-services / python-dockerflow / tests / django / test_django.py View on Github external
def test_check_database_connected_misconfigured(mocker):
    ensure_connection = mocker.patch("django.db.connection.ensure_connection")
    ensure_connection.side_effect = ImproperlyConfigured
    errors = checks.check_database_connected([])
    assert len(errors) == 1
    assert errors[0].id == health.ERROR_MISCONFIGURED_DATABASE