Skip to content

Commit

Permalink
Merge pull request #852 from marius-mather/test_list_query
Browse files Browse the repository at this point in the history
Add a test for list query params
  • Loading branch information
vitalik authored Sep 13, 2023
2 parents 526721b + 44bcf1f commit 8f76d30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ def get_query_type_optional_10(request, query: int = 10):
return f"foo bar {query}"


@router.get("/query/list")
def get_query_list(request, query: list[str] = Query(...)):
return ",".join(query)


@router.get("/query/param")
def get_query_param(request, query=Query(None)):
if query is None:
Expand Down
1 change: 1 addition & 0 deletions tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
("/query/int/default", 200, "foo bar 10"),
("/query/int/default?query=50", 200, "foo bar 50"),
("/query/int/default?query=foo", 422, response_not_valid_int),
("/query/list?query=a&query=b&query=c", 200, "a,b,c"),
("/query/param", 200, "foo bar"),
("/query/param?query=50", 200, "foo bar 50"),
("/query/param-required", 422, response_missing),
Expand Down

0 comments on commit 8f76d30

Please sign in to comment.