File size: 461 Bytes
80ef840
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from fastapi.testclient import TestClient

from app.main import app


def test_ticket_endpoint_returns_response():
    client = TestClient(app)
    response = client.post(
        "/api/tickets",
        json={"customer_id": "cust_001", "message": "My order #1234 is delayed. Can I get a refund?"},
    )
    assert response.status_code == 200
    payload = response.json()
    assert payload["ticket_id"].startswith("ticket_")
    assert "response" in payload