Skip to content

Commit f6fa15b

Browse files
committed
add test for unused auth
1 parent 589e403 commit f6fa15b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
openapi: 3.0.0
2+
info:
3+
title: 'basic, but not set in security section'
4+
version: 1.0.0
5+
servers:
6+
- url: 'https://pokeapi.co/'
7+
components:
8+
securitySchemes:
9+
basicAuth: # <-- arbitrary name for the security scheme
10+
type: http
11+
scheme: basic
12+
# security:
13+
# - basicAuth: [] # <-- use the same name here
14+
paths:
15+
/api/v2/pokemon/:
16+
get:
17+
operationId: pokemon_list
18+
responses:
19+
'200':
20+
description: OK

tests/integration/basics/test_auth.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ def test_basic_auth() -> None:
3030
}
3131

3232

33+
def test_unused_auth() -> None:
34+
source_dict = get_dict_by_case("artificial", "auth/basic_auth_not_used.yml")
35+
assert not source_dict["client"].get("auth")
36+
37+
3338
def test_oauth_warning() -> None:
3439
source_dict = get_dict_by_case("artificial", "auth/oauth.yml")
3540
assert not source_dict["client"].get("auth")

0 commit comments

Comments
 (0)