from fastapi.testclient import TestClient from main import app, plan_amount_usd client = TestClient(app) def test_checkout_rejects_unknown_plan(): response = client.post("/checkout", json={"plan": "enterprise"}) assert response.status_code == 400 assert "Unsupported plan" in response.text def test_paypal_rejects_unknown_plan(): response = client.post("/paypal/create-order", json={"plan": "enterprise"}) assert response.status_code == 400 assert "Unsupported plan" in response.text def test_square_rejects_unknown_plan(): response = client.post("/square/create-payment-link", json={"plan": "enterprise"}) assert response.status_code == 400 assert "Unsupported plan" in response.text def test_zero_override_preserved(): assert plan_amount_usd("pro", 0.0) == "0.00" assert plan_amount_usd("studio", 0) == "0.00"