diff --git a/collector/conftest.py b/collector/conftest.py index a925f11..6266efd 100644 --- a/collector/conftest.py +++ b/collector/conftest.py @@ -1,3 +1,7 @@ +import random +import string +from typing import Callable + import pytest from django.test import Client @@ -10,3 +14,12 @@ def enable_db_access_for_all_tests(db): @pytest.fixture(scope="session", name="session") def fixture_longlived_client() -> Client: return Client() + +@pytest.fixture(name="random_name") +def fixture_random_name_generator() -> Callable[[int], str]: + def name_generator(length: int = 7) -> str: + name = "".join(random.choices(string.ascii_letters, k=length)) + return name + + return name_generator +