fix all tests with new imports
This commit is contained in:
parent
87126ef254
commit
beddd1f469
1 changed files with 15 additions and 13 deletions
|
|
@ -3,7 +3,9 @@ from pathlib import Path
|
||||||
import pytest
|
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
|
||||||
|
from src.env_manager import DependencyRule, EnvFile, EnvManager
|
||||||
|
|
||||||
|
|
||||||
def test_complex_sorting() -> None:
|
def test_complex_sorting() -> None:
|
||||||
|
|
@ -18,8 +20,8 @@ def test_complex_sorting() -> None:
|
||||||
|
|
||||||
demo_types = ["a", "b", "c", "d", "e", "f", "g"]
|
demo_types = ["a", "b", "c", "d", "e", "f", "g"]
|
||||||
env_files = [EnvFile(env_type=t, env_path=Path(), config=dict()) for t in demo_types]
|
env_files = [EnvFile(env_type=t, env_path=Path(), config=dict()) for t in demo_types]
|
||||||
|
EnvManager.sort_env_files_by_rule
|
||||||
sorted_env_files = sort_env_files_by_rule(env_files, demo_rules)
|
sorted_env_files = EnvManager.sort_env_files_by_rule(env_files, demo_rules)
|
||||||
|
|
||||||
assert sorted_env_files[0].env_type == "e"
|
assert sorted_env_files[0].env_type == "e"
|
||||||
|
|
||||||
|
|
@ -35,7 +37,7 @@ def test_circular_import() -> None:
|
||||||
demo_types = ["a", "b", "c"]
|
demo_types = ["a", "b", "c"]
|
||||||
env_files = [EnvFile(env_type=t, env_path=Path(), config=dict()) for t in demo_types]
|
env_files = [EnvFile(env_type=t, env_path=Path(), config=dict()) for t in demo_types]
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
sort_env_files_by_rule(env_files, demo_rules)
|
EnvManager.sort_env_files_by_rule(env_files, demo_rules)
|
||||||
|
|
||||||
|
|
||||||
def test_real_env_files() -> None:
|
def test_real_env_files() -> None:
|
||||||
|
|
@ -45,9 +47,9 @@ def test_real_env_files() -> None:
|
||||||
Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress
|
Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress
|
||||||
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
||||||
]
|
]
|
||||||
env_files: list[EnvFile] = Coordinator._getn_env_files_list(ENV_FILES)
|
env_files: list[EnvFile] = EnvManager._get_env_files(ENV_FILES)
|
||||||
dependency_rules: list[DependencyRule] = Coordinator._get_dependency_rules(env_files)
|
dependency_rules: list[DependencyRule] = EnvManager._get_dependency_rules(env_files)
|
||||||
sorted_env_files = sort_env_files_by_rule(env_files, dependency_rules)
|
sorted_env_files = EnvManager.sort_env_files_by_rule(env_files, dependency_rules)
|
||||||
assert sorted_env_files[0].env_type == "authentik"
|
assert sorted_env_files[0].env_type == "authentik"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -59,9 +61,9 @@ def test_real_env_files_duplicate() -> None:
|
||||||
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
||||||
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
||||||
]
|
]
|
||||||
env_files: list[EnvFile] = Coordinator._getn_env_files_list(ENV_FILES)
|
env_files: list[EnvFile] = EnvManager._get_env_files(ENV_FILES)
|
||||||
dependency_rules: list[DependencyRule] = Coordinator._get_dependency_rules(env_files)
|
dependency_rules: list[DependencyRule] = EnvManager._get_dependency_rules(env_files)
|
||||||
sorted_env_files = sort_env_files_by_rule(env_files, dependency_rules)
|
sorted_env_files = EnvManager.sort_env_files_by_rule(env_files, dependency_rules)
|
||||||
assert sorted_env_files[0].env_type == "authentik"
|
assert sorted_env_files[0].env_type == "authentik"
|
||||||
assert sorted_env_files[1].env_type == "authentik"
|
assert sorted_env_files[1].env_type == "authentik"
|
||||||
assert sorted_env_files[2].env_type == "wordpress"
|
assert sorted_env_files[2].env_type == "wordpress"
|
||||||
|
|
@ -78,9 +80,9 @@ def test_real_env_files_duplicate_six() -> None:
|
||||||
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
Path("envfiles/login.test.dev.local-it.cloud.env"), # authentik
|
||||||
Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress
|
Path("envfiles/blog.test.dev.local-it.cloud.env"), # wordpress
|
||||||
]
|
]
|
||||||
env_files: list[EnvFile] = Coordinator._getn_env_files_list(ENV_FILES)
|
env_files: list[EnvFile] = EnvManager._get_env_files(ENV_FILES)
|
||||||
dependency_rules: list[DependencyRule] = Coordinator._get_dependency_rules(env_files)
|
dependency_rules: list[DependencyRule] = EnvManager._get_dependency_rules(env_files)
|
||||||
sorted_env_files = sort_env_files_by_rule(env_files, dependency_rules)
|
sorted_env_files = EnvManager.sort_env_files_by_rule(env_files, dependency_rules)
|
||||||
assert sorted_env_files[0].env_type == "authentik"
|
assert sorted_env_files[0].env_type == "authentik"
|
||||||
assert sorted_env_files[1].env_type == "authentik"
|
assert sorted_env_files[1].env_type == "authentik"
|
||||||
assert sorted_env_files[2].env_type == "authentik"
|
assert sorted_env_files[2].env_type == "authentik"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue