Skip to content

Commit 4f1f360

Browse files
committed
legibility
1 parent 42a2c26 commit 4f1f360

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

tests/test_openapi.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,20 +144,25 @@ def test_oidc_in_openapi_spec_public_endpoints(
144144
for path, method_config in openapi["paths"].items():
145145
for method, config in method_config.items():
146146
security = config.get("security")
147+
147148
if method == "options":
148-
assert not security, "OPTIONS requests should not be authenticated"
149-
elif security:
149+
assert (
150+
not security
151+
), "OPTIONS requests should not require authentication"
152+
continue
153+
154+
if security:
150155
assert (
151156
path not in expected_required_auth
152157
), f"Path {path} should not require authentication"
153-
else:
154-
assert (
155-
path in expected_required_auth
156-
), f"Path {path} should require authentication"
157-
assert any(
158-
method.casefold() == m.casefold()
159-
for m in expected_required_auth[path]
160-
)
158+
continue
159+
160+
assert (
161+
path in expected_required_auth
162+
), f"Path {path} should require authentication"
163+
assert any(
164+
method.casefold() == m.casefold() for m in expected_required_auth[path]
165+
)
161166

162167

163168
def test_auth_scheme_name_override(source_api: FastAPI, source_api_server: str):

0 commit comments

Comments
 (0)