Skip to content

How to set query param for test. #1163

@changja88

Description

@changja88

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions