diff --git a/tests/validator.py b/tests/validator.py index dedd03a..9491f35 100644 --- a/tests/validator.py +++ b/tests/validator.py @@ -13,25 +13,29 @@ os.chdir("..") import pytest import asfyaml +import repository + +# Rewire the notifications path, so we can test with a mock json file import feature.notifications feature.notifications.VALID_LISTS_FILE = "tests/mailinglists.json" -import repository + +# Set .asf.yaml to debug mode asfyaml.DEBUG = True @pytest.mark.validator def test_basic_yaml(): - EXPECTED_ENVS = {"production", "dev"} # We expect these two envs enabled - EXPECTED_FEATURES_MIN = {"test"} + expected_envs = {"production", "dev"} # We expect these two envs enabled + expected_minimum_features = {"test"} basic_yaml = open("tests/basic-dev-env.yaml", "r").read() testrepo = repository.Repository("/x1/gitbox/repos/private/whimsy/whimsy-private.git") a = asfyaml.ASFYamlInstance(testrepo, "humbedooh", basic_yaml) a.run_parts() # We should have both prod+dev envs enabled here - assert a.environments_enabled == EXPECTED_ENVS + assert a.environments_enabled == expected_envs # We should have at least our 'test' feature in the set - assert EXPECTED_FEATURES_MIN.issubset(a.enabled_features.keys()) + assert expected_minimum_features.issubset(a.enabled_features.keys()) # The repo should be marked as private by asfyaml assert testrepo.is_private is True, "Expected testrepo.private to be True, but wasn't!"