Update.
This commit is contained in:
@@ -34,56 +34,4 @@ async def test_dashboard_get_authorized(client):
|
||||
assert "My Files" in text
|
||||
|
||||
|
||||
async def test_order_post_unauthorized(client):
|
||||
resp = await client.post(
|
||||
"/order", data={"storage_amount": "10.5"}, allow_redirects=False
|
||||
)
|
||||
assert resp.status == 302
|
||||
assert resp.headers["Location"] == "/login"
|
||||
|
||||
|
||||
async def test_order_post_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.post("/order", data={"storage_amount": "10.5"}, allow_redirects=False)
|
||||
assert resp.status == 302
|
||||
assert resp.headers["Location"] == "/dashboard"
|
||||
|
||||
# Verify that the user's quota was updated
|
||||
user_service = client.app["user_service"]
|
||||
user = user_service.get_user_by_email("test@example.com")
|
||||
assert user["storage_quota_gb"] == 10.5
|
||||
|
||||
|
||||
async def test_order_post_invalid_amount(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.post("/order", data={"storage_amount": "0"})
|
||||
assert resp.status == 200
|
||||
text = await resp.text()
|
||||
assert "ensure this value is greater than 0" in text
|
||||
|
||||
resp = await client.post("/order", data={"storage_amount": "1001"})
|
||||
assert resp.status == 200
|
||||
text = await resp.text()
|
||||
assert "ensure this value is less than or equal to 1000" in text
|
||||
|
||||
Reference in New Issue
Block a user