Skip to content

Commit 5f9d384

Browse files
authored
Merge pull request #648 from averevki/fix-deny-with-tests
Change to valid return codes in deny_with tests
2 parents 6533e9a + 97f79c3 commit 5f9d384

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

testsuite/tests/singlecluster/authorino/response/test_deny_with.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ def authorization(authorization):
2323
"""Set custom deny responses and auth rule with only allowed path '/allow'"""
2424
authorization.responses.set_unauthenticated(
2525
DenyResponse(
26-
code=333,
26+
code=305,
2727
headers=HEADERS,
2828
message=Value("Unauthenticated message"),
2929
body=Value("You are unauthenticated."),
3030
)
3131
)
3232
authorization.responses.set_unauthorized(
3333
DenyResponse(
34-
code=444,
34+
code=417,
3535
headers=HEADERS,
3636
message=ValueFrom("My path is: " + "{context.request.http.path}"),
3737
body=ValueFrom("You are not authorized to access path: " + "{context.request.http.path}"),
@@ -51,23 +51,19 @@ def assert_headers(response):
5151
assert response.headers["x-dynamic-header"] == TESTING_PATH
5252

5353

54-
@pytest.mark.xfail
55-
@pytest.mark.issue("https://github.com/Kuadrant/kuadrant-operator/issues/1022")
5654
def test_unauthenticated(client):
5755
"""Test when no auth is passed results in custom unauthenticated response."""
5856
response = client.get(TESTING_PATH, auth=None)
59-
assert response.status_code == 333
57+
assert response.status_code == 305
6058
assert_headers(response)
6159
assert response.headers["x-ext-auth-reason"] == "Unauthenticated message"
6260
assert response.content.decode() == "You are unauthenticated."
6361

6462

65-
@pytest.mark.xfail
66-
@pytest.mark.issue("https://github.com/Kuadrant/kuadrant-operator/issues/1022")
6763
def test_unauthorized(client, auth):
6864
"""Test when not allowed path is passed results in custom unauthorized response."""
6965
response = client.get(TESTING_PATH, auth=auth)
70-
assert response.status_code == 444
66+
assert response.status_code == 417
7167
assert_headers(response)
7268
assert response.headers["x-ext-auth-reason"] == f"My path is: {TESTING_PATH}"
7369
assert response.content.decode() == f"You are not authorized to access path: {TESTING_PATH}"

0 commit comments

Comments
 (0)