|
|
|
|
|
async def test_index_get(client):
|
|
resp = await client.get("/")
|
|
assert resp.status == 200
|
|
text = await resp.text()
|
|
assert "Solutions for Everyone" in text
|
|
assert "Find Your Perfect Plan" in text
|
|
|
|
|
|
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={
|
|
"full_name": "Test User",
|
|
"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()
|
|
assert "Welcome back, Test User!" in text
|
|
assert "My Files" in text
|
|
|
|
|
|
|