A wheel whose top-level module is `app` collides with anything else in a user's venv, so the package that is about to be published takes the name it is published under. Only the Python package moves; the repo, the Docker WORKDIR and the compose project keep theirs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
27 lines
721 B
Python
27 lines
721 B
Python
import random
|
|
import string
|
|
|
|
from fastapi.testclient import TestClient
|
|
|
|
from fluksio.core.config import settings
|
|
|
|
|
|
def random_lower_string() -> str:
|
|
return "".join(random.choices(string.ascii_lowercase, k=32))
|
|
|
|
|
|
def random_email() -> str:
|
|
return f"{random_lower_string()}@{random_lower_string()}.com"
|
|
|
|
|
|
def get_superuser_token_headers(client: TestClient) -> dict[str, str]:
|
|
login_data = {
|
|
"username": settings.FIRST_SUPERUSER,
|
|
"password": settings.FIRST_SUPERUSER_PASSWORD,
|
|
}
|
|
r = client.post(f"{settings.API_V1_STR}/login/access-token", data=login_data)
|
|
tokens = r.json()
|
|
a_token = tokens["access_token"]
|
|
headers = {"Authorization": f"Bearer {a_token}"}
|
|
return headers
|