Skip to content

Commit c1a38e8

Browse files
committed
Add api test
1 parent 4920b07 commit c1a38e8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test_api.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,16 @@ def test_data_post_body():
272272
assert route.called
273273

274274

275+
def test_files_post_body():
276+
with respx.mock:
277+
url = "https://foo.bar/"
278+
file = ("file", ("filename.txt", b"...", "text/plain", {"X-Foo": "bar"}))
279+
route = respx.post(url, files={"file": mock.ANY}) % 201
280+
response = httpx.post(url, files=[file])
281+
assert response.status_code == 201
282+
assert route.called
283+
284+
275285
async def test_raising_content(client):
276286
async with MockRouter() as respx_mock:
277287
url = "https://foo.bar/"

0 commit comments

Comments
 (0)