Browse Source

Fix test for OpenAPI with support for Pydantic v1

pull/13515/head
Sebastián Ramírez 3 months ago
parent
commit
ac4ee52959
  1. 44
      tests/test_tutorial/test_header_param_models/test_tutorial003.py

44
tests/test_tutorial/test_header_param_models/test_tutorial003.py

@ -62,23 +62,33 @@ def test_header_param_model_no_underscore(client: TestClient):
assert response.json() == snapshot( assert response.json() == snapshot(
{ {
"detail": [ "detail": [
{ IsDict(
"type": "missing", {
"loc": ["header", "save_data"], "type": "missing",
"msg": "Field required", "loc": ["header", "save_data"],
"input": { "msg": "Field required",
"host": "testserver", "input": {
"traceparent": "123", "host": "testserver",
"x_tag": [], "traceparent": "123",
"accept": "*/*", "x_tag": [],
"accept-encoding": "gzip, deflate", "accept": "*/*",
"connection": "keep-alive", "accept-encoding": "gzip, deflate",
"user-agent": "testclient", "connection": "keep-alive",
"save-data": "true", "user-agent": "testclient",
"if-modified-since": "yesterday", "save-data": "true",
"x-tag": "two", "if-modified-since": "yesterday",
}, "x-tag": "two",
} },
}
)
| IsDict(
# TODO: remove when deprecating Pydantic v1
{
"type": "value_error.missing",
"loc": ["header", "save_data"],
"msg": "field required",
}
)
] ]
} }
) )

Loading…
Cancel
Save