|
|
@ -1,4 +1,3 @@ |
|
|
from dirty_equals import IsDict |
|
|
|
|
|
from fastapi.testclient import TestClient |
|
|
from fastapi.testclient import TestClient |
|
|
|
|
|
|
|
|
from .main import app |
|
|
from .main import app |
|
|
@ -291,30 +290,17 @@ def test_path_param_min_maxlength_foobar(): |
|
|
def test_path_param_min_maxlength_f(): |
|
|
def test_path_param_min_maxlength_f(): |
|
|
response = client.get("/path/param-min_maxlength/f") |
|
|
response = client.get("/path/param-min_maxlength/f") |
|
|
assert response.status_code == 422 |
|
|
assert response.status_code == 422 |
|
|
assert response.json() == IsDict( |
|
|
assert response.json() == { |
|
|
{ |
|
|
"detail": [ |
|
|
"detail": [ |
|
|
{ |
|
|
{ |
|
|
"type": "string_too_short", |
|
|
"type": "string_too_short", |
|
|
"loc": ["path", "item_id"], |
|
|
"loc": ["path", "item_id"], |
|
|
"msg": "String should have at least 2 characters", |
|
|
"msg": "String should have at least 2 characters", |
|
|
"input": "f", |
|
|
"input": "f", |
|
|
"ctx": {"min_length": 2}, |
|
|
"ctx": {"min_length": 2}, |
|
|
} |
|
|
} |
|
|
] |
|
|
] |
|
|
} |
|
|
} |
|
|
|
|
|
) | IsDict( |
|
|
|
|
|
{ |
|
|
|
|
|
"detail": [ |
|
|
|
|
|
{ |
|
|
|
|
|
"loc": ["path", "item_id"], |
|
|
|
|
|
"msg": "ensure this value has at least 2 characters", |
|
|
|
|
|
"type": "value_error.any_str.min_length", |
|
|
|
|
|
"ctx": {"limit_value": 2}, |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_path_param_gt_42(): |
|
|
def test_path_param_gt_42(): |
|
|
|