improve dir creation

This commit is contained in:
Daniel 2023-11-22 13:14:12 +01:00
parent f277d95f2c
commit 18c695d178

View file

@ -7,7 +7,7 @@ from icecream import ic
from tests_authentik.runner_authentik import RunnerAuthentik
from tests_wordpress.runner_wordpress import RunnerWordpress
TESTS_DIR = Path("tests")
TESTS_DIR = Path("../tests")
ENV_FILES = [
Path("../envfiles/login.test.dev.local-it.cloud.env"), # authentik
@ -32,6 +32,7 @@ RUNNER_DICT: dict[str, type[TestRunner]] = {"wordpress": RunnerWordpress}
class Wrapper:
def __init__(self, env_files: list[Path]):
self.env_files = env_files
self.runners: list[TestRunner] = []
self.setup_tests()
return
@ -42,9 +43,17 @@ class Wrapper:
runner = self.load_runners(config, dotenv_path)
runner.run_tests()
def load_runners(self, config: dict[str, str], dotenv_path: Path) -> TestRunner:
config_type = config["TYPE"]
ic(config_type)
RunnerClass = RUNNER_DICT[config_type]
return RunnerClass(dotenv_path)
def setup_tests(self):
session_id = self.get_session_id()
test_dir = self.create_test_dir(session_id)
self.create_records_dir(test_dir)
self.create_states_dir(test_dir)
@staticmethod
def get_session_id() -> str:
@ -70,13 +79,6 @@ class Wrapper:
states.mkdir()
return states
def load_runners(self, config: dict[str, str], dotenv_path: Path) -> TestRunner:
config_type = config["TYPE"]
ic(config_type)
RunnerClass = RUNNER_DICT[config_type]
return RunnerClass(dotenv_path)
if __name__ == "__main__":
dotenv_path = Path(__file__).parent / "./blog.dev.local-it.cloud.env"
t = Wrapper(dotenv_path)
t = Wrapper(ENV_FILES)