(tmp_path: Path, test_client_factory: TestClientFactory)
| 32 | |
| 33 | |
| 34 | def test_staticfiles_with_pathlib(tmp_path: Path, test_client_factory: TestClientFactory) -> None: |
| 35 | path = tmp_path / "example.txt" |
| 36 | with open(path, "w") as file: |
| 37 | file.write("<file content>") |
| 38 | |
| 39 | app = StaticFiles(directory=tmp_path) |
| 40 | client = test_client_factory(app) |
| 41 | response = client.get("/example.txt") |
| 42 | assert response.status_code == 200 |
| 43 | assert response.text == "<file content>" |
| 44 | |
| 45 | |
| 46 | def test_staticfiles_head_with_middleware(tmpdir: Path, test_client_factory: TestClientFactory) -> None: |
nothing calls this directly
no test coverage detected