(tmpdir: Path, test_client_factory: TestClientFactory)
| 155 | |
| 156 | |
| 157 | def test_multipart_request_files(tmpdir: Path, test_client_factory: TestClientFactory) -> None: |
| 158 | path = os.path.join(tmpdir, "test.txt") |
| 159 | with open(path, "wb") as file: |
| 160 | file.write(b"<file content>") |
| 161 | |
| 162 | client = test_client_factory(app) |
| 163 | with open(path, "rb") as f: |
| 164 | response = client.post("/", files={"test": f}) |
| 165 | assert response.json() == { |
| 166 | "test": { |
| 167 | "filename": "test.txt", |
| 168 | "size": 14, |
| 169 | "content": "<file content>", |
| 170 | "content_type": "text/plain", |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | |
| 175 | def test_multipart_request_files_with_content_type(tmpdir: Path, test_client_factory: TestClientFactory) -> None: |
nothing calls this directly
no test coverage detected