Example #1
0
    def test_fail_bad_specifier_in_dict(self):
        errors = checks.check_postgresql_version(databases=["default"])

        assert len(errors) == 1
        assert errors[0].id == "dvc.E002"
        assert errors[0].msg == (
            "settings.VERSION_CHECKS['postgresql'] is misconfigured. '13.1' is "
            + "not a valid PEP440 specifier.")
Example #2
0
    def test_fail_bad_type(self):
        errors = checks.check_postgresql_version(databases=["default"])

        assert len(errors) == 1
        assert errors[0].id == "dvc.E001"
        assert errors[0].msg == (
            "settings.VERSION_CHECKS['postgresql'] is misconfigured." +
            " Expected a str or dict[str, str] but got 13.")
Example #3
0
    def test_fail_out_of_range(self):
        with fake_postgresql(pg_version=13_00_00):
            errors = checks.check_postgresql_version(databases=["default"])

        assert len(errors) == 1
        assert errors[0].id == "dvc.E004"
        assert errors[0].msg == (
            "The current version of PostgreSQL (13.0) for the default" +
            " database connection does not match the specified range" +
            " (~=13.1).")
Example #4
0
    def test_success_unspecified(self):
        errors = checks.check_postgresql_version(databases=["default"])

        assert errors == []
Example #5
0
    def test_success_specified_other_alias(self):
        with fake_postgresql(pg_version=13_00_00):
            errors = checks.check_postgresql_version(databases=["default"])

        assert errors == []
Example #6
0
    def test_success_databases_none(self):
        with fake_postgresql(pg_version=13_02_00):
            errors = checks.check_postgresql_version(databases=None)

        assert errors == []
Example #7
0
    def test_success_not_asked_about(self):
        with fake_postgresql(pg_version=13_02_00):
            errors = checks.check_postgresql_version(databases=["other"])

        assert errors == []
Example #8
0
    def test_success_in_range(self):
        with fake_postgresql(pg_version=13_02_00):
            errors = checks.check_postgresql_version(databases=["default"])

        assert errors == []
Example #9
0
    def test_success_no_postgresql_connections(self):
        errors = checks.check_postgresql_version(databases=["default"])

        assert errors == []