mirror of https://github.com/tiangolo/fastapi.git
✅ Refactor tests for duplicate operation ID generation for compatibility with other tools running the FastAPI test suite (#10876)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
parent
61a08d0c60
commit
f18eadb7de
|
|
@ -1626,6 +1626,9 @@ def test_warn_duplicate_operation_id():
|
||||||
with warnings.catch_warnings(record=True) as w:
|
with warnings.catch_warnings(record=True) as w:
|
||||||
warnings.simplefilter("always")
|
warnings.simplefilter("always")
|
||||||
client.get("/openapi.json")
|
client.get("/openapi.json")
|
||||||
assert len(w) == 2
|
assert len(w) >= 2
|
||||||
assert issubclass(w[-1].category, UserWarning)
|
duplicate_warnings = [
|
||||||
assert "Duplicate Operation ID" in str(w[-1].message)
|
warning for warning in w if issubclass(warning.category, UserWarning)
|
||||||
|
]
|
||||||
|
assert len(duplicate_warnings) > 0
|
||||||
|
assert "Duplicate Operation ID" in str(duplicate_warnings[0].message)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue