25 lines
578 B
Python
25 lines
578 B
Python
import random
|
|
import string
|
|
from typing import Callable
|
|
|
|
import pytest
|
|
from django.test import Client
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def enable_db_access_for_all_tests(db):
|
|
pass
|
|
|
|
|
|
@pytest.fixture(scope="session", name="session")
|
|
def fixture_longlived_client() -> Client:
|
|
return Client()
|
|
|
|
|
|
@pytest.fixture(name="random_name", scope="session")
|
|
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
|