How to use the dockerflow.django.checks.check_migrations_applied 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
migration_mock = mocker.Mock()
    migration_mock.app_label = "app"

    migration_mock2 = mocker.Mock()
    migration_mock2.app_label = "app2"

    mock_loader.return_value.graph.nodes = {
        "app": migration_mock,
        "app2": migration_mock2,
    }

    app_config_mock = mocker.Mock()
    app_config_mock.label = "app"

    errors = checks.check_migrations_applied([app_config_mock])
    assert len(errors) == 1
    assert errors[0].id == health.WARNING_UNAPPLIED_MIGRATION

    mock_loader.return_value.migrated_apps = ["app"]
    errors = checks.check_migrations_applied([])
    assert len(errors) == 1
    assert errors[0].id == health.WARNING_UNAPPLIED_MIGRATION

    mock_loader.return_value.applied_migrations = ["app"]
    errors = checks.check_migrations_applied([])
    assert len(errors) == 0
github mozilla-services / python-dockerflow / tests / django / test_django.py View on Github external
def test_check_migrations_applied_cannot_check_migrations(exception, mocker):
    mocker.patch("django.db.migrations.loader.MigrationLoader", side_effect=exception)
    errors = checks.check_migrations_applied([])
    assert len(errors) == 1
    assert errors[0].id == health.INFO_CANT_CHECK_MIGRATIONS