@@ -23,15 +23,15 @@ def authorization(authorization):
23
23
"""Set custom deny responses and auth rule with only allowed path '/allow'"""
24
24
authorization .responses .set_unauthenticated (
25
25
DenyResponse (
26
- code = 333 ,
26
+ code = 305 ,
27
27
headers = HEADERS ,
28
28
message = Value ("Unauthenticated message" ),
29
29
body = Value ("You are unauthenticated." ),
30
30
)
31
31
)
32
32
authorization .responses .set_unauthorized (
33
33
DenyResponse (
34
- code = 444 ,
34
+ code = 417 ,
35
35
headers = HEADERS ,
36
36
message = ValueFrom ("My path is: " + "{context.request.http.path}" ),
37
37
body = ValueFrom ("You are not authorized to access path: " + "{context.request.http.path}" ),
@@ -51,23 +51,19 @@ def assert_headers(response):
51
51
assert response .headers ["x-dynamic-header" ] == TESTING_PATH
52
52
53
53
54
- @pytest .mark .xfail
55
- @pytest .mark .issue ("https://github.com/Kuadrant/kuadrant-operator/issues/1022" )
56
54
def test_unauthenticated (client ):
57
55
"""Test when no auth is passed results in custom unauthenticated response."""
58
56
response = client .get (TESTING_PATH , auth = None )
59
- assert response .status_code == 333
57
+ assert response .status_code == 305
60
58
assert_headers (response )
61
59
assert response .headers ["x-ext-auth-reason" ] == "Unauthenticated message"
62
60
assert response .content .decode () == "You are unauthenticated."
63
61
64
62
65
- @pytest .mark .xfail
66
- @pytest .mark .issue ("https://github.com/Kuadrant/kuadrant-operator/issues/1022" )
67
63
def test_unauthorized (client , auth ):
68
64
"""Test when not allowed path is passed results in custom unauthorized response."""
69
65
response = client .get (TESTING_PATH , auth = auth )
70
- assert response .status_code == 444
66
+ assert response .status_code == 417
71
67
assert_headers (response )
72
68
assert response .headers ["x-ext-auth-reason" ] == f"My path is: { TESTING_PATH } "
73
69
assert response .content .decode () == f"You are not authorized to access path: { TESTING_PATH } "
0 commit comments