|
|
|
@ -70,7 +70,38 @@ def test_query_params_str_validations_item_query_nonregexquery(): |
|
|
|
] |
|
|
|
} |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
@needs_py310 |
|
|
|
def test_query_params_str_validations_item_query_empty(): |
|
|
|
client = get_client() |
|
|
|
response = client.get("/items/", params = {"q": ""}) |
|
|
|
assert response.status_code == 422 |
|
|
|
assert response.json() == IsDict( |
|
|
|
{ |
|
|
|
"detail": [ |
|
|
|
{ |
|
|
|
"type": "string_pattern_mismatch", |
|
|
|
"loc": ["query", "q"], |
|
|
|
"msg": "String should match pattern '^fixedquery$'", |
|
|
|
"input": "", |
|
|
|
"ctx": {"pattern": "^fixedquery$"}, |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
) | IsDict( |
|
|
|
# TODO: remove when deprecating Pydantic v1 |
|
|
|
{ |
|
|
|
"detail": [ |
|
|
|
{ |
|
|
|
"ctx": {"pattern": "^fixedquery$"}, |
|
|
|
"loc": ["query", "q"], |
|
|
|
"msg": 'string does not match regex "^fixedquery$"', |
|
|
|
"type": "value_error.str.regex", |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
@needs_py310 |
|
|
|
def test_openapi_schema(): |
|
|
|
|