Browse Source

Fix testcase for stream_input_type

pull/15435/head
Prashanth1602 3 months ago
parent
commit
65c67e8c08
  1. 10
      tests/test_sse.py

10
tests/test_sse.py

@ -280,6 +280,16 @@ def test_include_router_copies_stream_item_type():
route = next(r for r in main_app.routes if r.path == "/stream_item_type") route = next(r for r in main_app.routes if r.path == "/stream_item_type")
assert getattr(route, "stream_item_type", None) == Item assert getattr(route, "stream_item_type", None) == Item
with TestClient(main_app) as client:
response = client.get("/stream_item_type")
assert response.status_code == 200
assert response.headers["content-type"] == "text/event-stream; charset=utf-8"
data_lines = [
line for line in response.text.strip().split("\n") if line.startswith("data: ")
]
assert len(data_lines) == 1
assert '"name":"Plumbus"' in data_lines[0] or '"name": "Plumbus"' in data_lines[0]
# Keepalive ping tests # Keepalive ping tests

Loading…
Cancel
Save