authentik.lib.tests.utils
Test utils
1"""Test utils""" 2 3from inspect import currentframe 4from pathlib import Path 5 6 7def load_fixture(path: str, **kwargs) -> str: 8 """Load fixture, optionally formatting it with kwargs""" 9 current = currentframe() 10 parent = current.f_back 11 calling_file_path = parent.f_globals["__file__"] 12 with open(Path(calling_file_path).resolve().parent / Path(path), encoding="utf-8") as _fixture: 13 fixture = _fixture.read() 14 try: 15 return fixture % kwargs 16 except TypeError, ValueError: 17 return fixture
def
load_fixture(path: str, **kwargs) -> str:
8def load_fixture(path: str, **kwargs) -> str: 9 """Load fixture, optionally formatting it with kwargs""" 10 current = currentframe() 11 parent = current.f_back 12 calling_file_path = parent.f_globals["__file__"] 13 with open(Path(calling_file_path).resolve().parent / Path(path), encoding="utf-8") as _fixture: 14 fixture = _fixture.read() 15 try: 16 return fixture % kwargs 17 except TypeError, ValueError: 18 return fixture
Load fixture, optionally formatting it with kwargs