add circular import test

This commit is contained in:
Daniel 2023-12-04 14:44:40 +01:00
parent dc0e568c04
commit d40ae79991

View file

@ -1,5 +1,7 @@
from pathlib import Path from pathlib import Path
import pytest
from src.coordinator import Coordinator from src.coordinator import Coordinator
from src.env_file_helper import DependencyRule, EnvFile, sort_env_files_by_rule from src.env_file_helper import DependencyRule, EnvFile, sort_env_files_by_rule
@ -22,6 +24,20 @@ def test_complex_sorting() -> None:
assert sorted_env_files[0].env_type == "e" assert sorted_env_files[0].env_type == "e"
def test_circular_import() -> None:
"""This test will raise ValueError because the example input cannot be correctly ordered"""
demo_rules = [
DependencyRule("a", "b"),
DependencyRule("b", "c"),
DependencyRule("c", "a"),
]
demo_types = ["a", "b", "c"]
env_files = [EnvFile(env_type=t, env_path=Path(), config=dict()) for t in demo_types]
with pytest.raises(ValueError):
sort_env_files_by_rule(env_files, demo_rules)
def test_real_env_files() -> None: def test_real_env_files() -> None:
"""authentik should be first""" """authentik should be first"""