Repository: dotX12/pyfa-converter (language: python)

Issue:
add form test
add form test and fixup test data (date was hardcoded)


Discussion / hints:

Fix patch:
diff --git a/examples/main.py b/examples/main.py
index f016f65..5312b9d 100644
--- a/examples/main.py
+++ b/examples/main.py
@@ -50,7 +50,7 @@ async def foo(
         PostContractSmallDoubleBodySchema
     ),
 ):
-    return {"bar": "bar"}
+    return {"data": data}
 
 
 @app.post("/test_query_list")
diff --git a/pyfa_converter/utils.py b/pyfa_converter/utils.py
new file mode 100644
index 0000000..e69de29


Test patch:
diff --git a/tests/body_test.py b/tests/body_test.py
index 9c03f91..28aa708 100644
--- a/tests/body_test.py
+++ b/tests/body_test.py
@@ -9,7 +9,7 @@ async def tests_one(async_client: AsyncClient):
 
     data = {
         "title": "KEY1",
-        "date": datetime.datetime.now().isoformat(),
+        "date": datetime.datetime(2022, 9, 13).isoformat(),
         "amount": 10212.11,
         "unit_price": 12012.12,
     }
diff --git a/tests/form_test.py b/tests/form_test.py
new file mode 100644
index 0000000..01993d4
--- /dev/null
+++ b/tests/form_test.py
@@ -0,0 +1,17 @@
+import pytest
+from httpx import AsyncClient
+
+
+@pytest.mark.asyncio
+async def tests_one(async_client: AsyncClient):
+    params = {"id": 100, "title": "test", "data": [1, 2, 3, 4, 5]}
+
+    response_post = await async_client.post(
+        url="/test",
+        data=params,
+    )
+
+    assert response_post.status_code in [200, 201]
+    assert response_post.json() == {
+        "data": {"id": 100, "title": "test", "data": [1, 2, 3, 4, 5]}
+    }