diff --git a/tests/test_models.py b/tests/test_models.py index f04a419e..c9e64318 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -384,7 +384,7 @@ def list_query(self, request: Request) -> Select: async def test_edit_form_query() -> None: session = session_maker() - batman = User(name="batman") + batman = User(id=123, name="batman") batcave = Address(user=batman, name="bat cave") wayne_manor = Address(user=batman, name="wayne manor") session.add(batman) @@ -405,8 +405,13 @@ def edit_form_query(self, request: Request) -> Select: ) view = UserAdmin() - request = Request({"type": "http", "path_params": {"pk": batman.id}}) - user_obj = await view.get_object_for_edit(request) + + class RequestObject(object): + pass + + request_object = RequestObject() + request_object.path_params = {"pk": 123} + user_obj = await view.get_object_for_edit(request_object) assert len(user_obj.addresses) == 1