MCPcopy
hub / github.com/encode/starlette / test_file_response_with_inline_disposition

Function test_file_response_with_inline_disposition

tests/test_responses.py:336–347  ·  view source on GitHub ↗
(tmp_path: Path, test_client_factory: TestClientFactory)

Source from the content-addressed store, hash-verified

334
335
336def test_file_response_with_inline_disposition(tmp_path: Path, test_client_factory: TestClientFactory) -> None:
337 content = b"file content"
338 filename = "hello.txt"
339 path = tmp_path / filename
340 path.write_bytes(content)
341 app = FileResponse(path=path, filename=filename, content_disposition_type="inline")
342 client = test_client_factory(app)
343 response = client.get("/")
344 expected_disposition = 'inline; filename="hello.txt"'
345 assert response.status_code == status.HTTP_200_OK
346 assert response.content == content
347 assert response.headers["content-disposition"] == expected_disposition
348
349
350def test_file_response_with_range_header(tmp_path: Path, test_client_factory: TestClientFactory) -> None:

Callers

nothing calls this directly

Calls 3

FileResponseClass · 0.90
test_client_factoryFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected