(tmp_path: Path, test_client_factory: TestClientFactory)
| 320 | |
| 321 | |
| 322 | def test_file_response_with_chinese_filename(tmp_path: Path, test_client_factory: TestClientFactory) -> None: |
| 323 | content = b"file content" |
| 324 | filename = "你好.txt" # probably "Hello.txt" in Chinese |
| 325 | path = tmp_path / filename |
| 326 | path.write_bytes(content) |
| 327 | app = FileResponse(path=path, filename=filename) |
| 328 | client = test_client_factory(app) |
| 329 | response = client.get("/") |
| 330 | expected_disposition = "attachment; filename*=utf-8''%E4%BD%A0%E5%A5%BD.txt" |
| 331 | assert response.status_code == status.HTTP_200_OK |
| 332 | assert response.content == content |
| 333 | assert response.headers["content-disposition"] == expected_disposition |
| 334 | |
| 335 | |
| 336 | def test_file_response_with_inline_disposition(tmp_path: Path, test_client_factory: TestClientFactory) -> None: |
nothing calls this directly
no test coverage detected