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>
47 lines
1.3 KiB
Python
47 lines
1.3 KiB
Python
import pytest
|
|
from fastapi.testclient import TestClient
|
|
from sqlmodel import Session, select
|
|
|
|
from fluksio.core.config import settings
|
|
from fluksio.models import User
|
|
|
|
|
|
def test_create_user(client: TestClient, db: Session) -> None:
|
|
r = client.post(
|
|
f"{settings.API_V1_STR}/private/users/",
|
|
json={
|
|
"email": "pollo@listo.com",
|
|
"password": "password123",
|
|
"full_name": "Pollo Listo",
|
|
},
|
|
)
|
|
|
|
assert r.status_code == 200
|
|
|
|
data = r.json()
|
|
|
|
user = db.exec(select(User).where(User.id == data["id"])).first()
|
|
|
|
assert user
|
|
assert user.email == "pollo@listo.com"
|
|
assert user.full_name == "Pollo Listo"
|
|
|
|
|
|
def test_creating_a_user_is_refused_unless_the_private_api_is_enabled(
|
|
client: TestClient, monkeypatch: pytest.MonkeyPatch
|
|
) -> None:
|
|
"""The route is always mounted so the SDK keeps its shape; the opt-in is
|
|
what decides whether unauthenticated user seeding actually works."""
|
|
monkeypatch.setattr(settings, "PRIVATE_API_ENABLED", False)
|
|
|
|
r = client.post(
|
|
f"{settings.API_V1_STR}/private/users/",
|
|
json={
|
|
"email": "nobody@listo.com",
|
|
"password": "password123",
|
|
"full_name": "Nobody",
|
|
},
|
|
)
|
|
|
|
assert r.status_code == 403
|