mirror of
https://github.com/creyD/creyPY.git
synced 2026-04-12 19:30:30 +02:00
feat : Add Patch to obj lifecycle
This commit is contained in:
@@ -140,6 +140,7 @@ class AbstractTestAPI(unittest.IsolatedAsyncioTestCase):
|
|||||||
pagination: bool = True,
|
pagination: bool = True,
|
||||||
id_field: str = "id",
|
id_field: str = "id",
|
||||||
created_at_check: bool = True,
|
created_at_check: bool = True,
|
||||||
|
patch: dict| None = None,
|
||||||
):
|
):
|
||||||
# GET LIST
|
# GET LIST
|
||||||
re = await self.get(url)
|
re = await self.get(url)
|
||||||
@@ -164,6 +165,14 @@ class AbstractTestAPI(unittest.IsolatedAsyncioTestCase):
|
|||||||
re = await self.get(f"{url}{obj_id}/")
|
re = await self.get(f"{url}{obj_id}/")
|
||||||
self.assertEqual(re[id_field], obj_id)
|
self.assertEqual(re[id_field], obj_id)
|
||||||
|
|
||||||
|
# PATCH
|
||||||
|
if patch:
|
||||||
|
for key, value in patch.items():
|
||||||
|
input_obj[key] = value
|
||||||
|
re = await self.patch(f"{url}{obj_id}/", obj=input_obj)
|
||||||
|
for key, value in patch.items():
|
||||||
|
self.assertEqual(re[key],value)
|
||||||
|
|
||||||
# GET LIST
|
# GET LIST
|
||||||
re = await self.get(url)
|
re = await self.get(url)
|
||||||
if pagination:
|
if pagination:
|
||||||
|
|||||||
Reference in New Issue
Block a user