import pytest @pytest.mark.asyncio async def test_waitlist_join_and_idempotent_rejoin(client): response = await client.post( "/api/shop/waitlist", json={"email": "hunter@example.com", "interest": "quantum-box"} ) assert response.status_code == 201 assert response.json()["status"] == "listed" again = await client.post( "/api/shop/waitlist", json={"email": "hunter@example.com"} ) assert again.status_code == 201 assert again.json()["status"] == "already_listed" @pytest.mark.asyncio async def test_waitlist_rejects_bad_email(client): response = await client.post("/api/shop/waitlist", json={"email": "not-an-email"}) assert response.status_code == 422 @pytest.mark.asyncio async def test_waitlist_is_public(client): # No auth cookie — the shop is open to every passing seeker. response = await client.post("/api/shop/waitlist", json={"email": "ghost@example.org"}) assert response.status_code == 201