(tmpdir: Path, test_client_factory: TestClientFactory)
| 20 | |
| 21 | |
| 22 | def test_staticfiles(tmpdir: Path, test_client_factory: TestClientFactory) -> None: |
| 23 | path = os.path.join(tmpdir, "example.txt") |
| 24 | with open(path, "w") as file: |
| 25 | file.write("<file content>") |
| 26 | |
| 27 | app = StaticFiles(directory=tmpdir) |
| 28 | client = test_client_factory(app) |
| 29 | response = client.get("/example.txt") |
| 30 | assert response.status_code == 200 |
| 31 | assert response.text == "<file content>" |
| 32 | |
| 33 | |
| 34 | def test_staticfiles_with_pathlib(tmp_path: Path, test_client_factory: TestClientFactory) -> None: |
nothing calls this directly
no test coverage detected