(tmpdir: Path, test_client_factory: TestClientFactory)
| 80 | |
| 81 | |
| 82 | def test_staticfiles_post(tmpdir: Path, test_client_factory: TestClientFactory) -> None: |
| 83 | path = os.path.join(tmpdir, "example.txt") |
| 84 | with open(path, "w") as file: |
| 85 | file.write("<file content>") |
| 86 | |
| 87 | routes = [Mount("/", app=StaticFiles(directory=tmpdir), name="static")] |
| 88 | app = Starlette(routes=routes) |
| 89 | client = test_client_factory(app) |
| 90 | |
| 91 | response = client.post("/example.txt") |
| 92 | assert response.status_code == 405 |
| 93 | assert response.text == "Method Not Allowed" |
| 94 | |
| 95 | |
| 96 | def test_staticfiles_with_directory_returns_404(tmpdir: Path, test_client_factory: TestClientFactory) -> None: |
nothing calls this directly
no test coverage detected