We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7f0261f commit 0f2df83Copy full SHA for 0f2df83
tests/api/test_import_xlsx.py
@@ -0,0 +1,27 @@
1
+from anyio import Path
2
+
3
+import pytest
4
+from fastapi import status
5
+from httpx import AsyncClient
6
7
+# Integration tests
8
+pytestmark = pytest.mark.anyio
9
10
11
+async def test_import_animals(client: AsyncClient):
12
+ # Arrange
13
+ expected_status = status.HTTP_201_CREATED
14
+ headers = {"Content-type": "multipart/form-data; boundary={}"}
15
16
+ path = Path("tests/api/nonsense.xlsx")
17
18
+ _bytes = await path.read_bytes()
19
20
+ response = await client.post(
21
+ "/nonsense/import",
22
+ files={"xlsx": ("nonsense.xlsx", _bytes)},
23
+ headers=headers,
24
+ )
25
26
+ assert response.status_code == expected_status
27
+ assert response.json() == {'filename': 'nonsense.xlsx', 'nonsense_records': 10}
0 commit comments