@@ -16,7 +16,6 @@ def authorization(authorization, oidc_provider):
16
16
return authorization
17
17
18
18
19
- @pytest .fixture (scope = "module" , params = ("keycloak" , "auth0" ))
20
19
def oidc_provider (request ) -> OIDCProvider :
21
20
"""Fixture which enables switching out OIDC providers for individual modules"""
22
21
return request .getfixturevalue (request .param )
@@ -31,25 +30,21 @@ def wrong_auth(oidc_provider, auth0, keycloak):
31
30
return HttpxOidcClientAuth (token )
32
31
33
32
34
- def test_correct_auth (client , auth ):
35
- """Tests correct auth"""
33
+ @pytest .mark .parametrize (
34
+ "oidc_provider" ,
35
+ [pytest .param ("keycloak" , marks = [pytest .mark .smoke ]), pytest .param ("auth0" )],
36
+ indirect = True ,
37
+ )
38
+ def test_auth_identity (client , auth , wrong_auth ):
39
+ """Tests endpoint protection with auth identity"""
40
+ response = client .get ("/get" )
41
+ assert response .status_code == 401
42
+
36
43
response = client .get ("/get" , auth = auth )
37
44
assert response .status_code == 200
38
45
39
-
40
- def test_wrong_auth (wrong_auth , client ):
41
- """Tests request with wrong token"""
42
46
response = client .get ("/get" , auth = wrong_auth )
43
47
assert response .status_code == 401
44
48
45
-
46
- def test_no_auth (client ):
47
- """Tests request without any auth"""
48
- response = client .get ("/get" )
49
- assert response .status_code == 401
50
-
51
-
52
- def test_invalid_auth (client ):
53
- """Tests request with invalid token"""
54
49
response = client .get ("/get" , headers = {"Authorization" : "Bearer xyz" })
55
50
assert response .status_code == 401
0 commit comments