Skip to content

Commit

Permalink
cleanups + docco
Browse files Browse the repository at this point in the history
  • Loading branch information
Humbedooh committed Nov 4, 2024
1 parent a7a0ba6 commit 6bff0e8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
Expand Down

0 comments on commit 6bff0e8

Please sign in to comment.