38 lines
984 B
Python
Raw Normal View History

2025-11-08 18:20:25 +01:00
async def test_index_get(client):
resp = await client.get("/")
assert resp.status == 200
text = await resp.text()
2025-11-08 20:09:58 +01:00
assert "Solutions for Everyone" in text
assert "Find Your Perfect Plan" in text
2025-11-08 18:59:06 +01:00
2025-11-08 18:20:25 +01:00
async def test_dashboard_get_unauthorized(client):
resp = await client.get("/dashboard", allow_redirects=False)
assert resp.status == 302
assert resp.headers["Location"] == "/login"
async def test_dashboard_get_authorized(client):
await client.post(
"/register",
data={
2025-11-08 18:59:06 +01:00
"full_name": "Test User",
2025-11-08 18:20:25 +01:00
"email": "test@example.com",
"password": "password",
"confirm_password": "password",
},
)
await client.post(
"/login", data={"email": "test@example.com", "password": "password"}
)
resp = await client.get("/dashboard")
assert resp.status == 200
text = await resp.text()
2025-11-08 20:33:53 +01:00
assert "Welcome back, Test User!" in text
2025-11-08 18:59:06 +01:00
assert "My Files" in text
2025-11-08 18:20:25 +01:00