django-ninja icon indicating copy to clipboard operation
django-ninja copied to clipboard

How to set query param for test.

Open changja88 opened this issue 9 months ago • 0 comments

Here is the def @nick_name_router.get( path="", response={200: MemberDuplicationOutSchema}, ) def api_nick_name_duplication_check(request: Router, nickname: str) -> APIResponse[MemberDuplicationOutSchema]: is_exists: StrictBool = MemberRegisterApp().is_nickname_able(nick_name=nickname) return MemberDuplicationOutSchema(is_able=not is_exists)

and test def is below def test_api_register_member_wanted_info(self): client = TestClient(nick_name_router)

response: NinjaResponse = client.get(path="", data={"nickname": "abc"}, content_type="application/json")
response: NinjaResponse = client.get(path="", nickname="abc", content_type="application/json")

print(response.json())

in this case test reuslt says I did not pass nickname query param. How Can I pass nickname param in test case

Tanks

changja88 avatar May 12 '24 08:05 changja88