Skip to content

Commit 275fd4f

Browse files
committedOct 26, 2022
Make user_info test use two users
1 parent be8568b commit 275fd4f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed
 

‎testsuite/oidc/rhsso/objects.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def create_user(self, username, password, **kwargs):
3333
"""Creates new user"""
3434
kwargs["username"] = username
3535
kwargs["enabled"] = True
36-
kwargs["email"] = f"{username}@anything.invalid"
36+
kwargs.setdefault("email", f"{username}@anything.invalid")
3737
self.admin.create_user(kwargs)
3838
user_id = self.admin.get_user_id(username)
3939
self.admin.set_user_password(user_id, password, temporary=False)

‎testsuite/tests/kuadrant/authorino/metadata/test_user_info.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@
44
"""
55
import pytest
66

7+
from testsuite.httpx.auth import HttpxOidcClientAuth
78
from testsuite.openshift.objects.auth_config import Rule
89

910

11+
@pytest.fixture(scope="module")
12+
def user2(rhsso):
13+
"""Second User which has incorrect email"""
14+
return rhsso.realm.create_user("user2", "password", email="test@test.com")
15+
16+
1017
@pytest.fixture(scope="module")
1118
def authorization(authorization, rhsso):
1219
"""
@@ -25,8 +32,8 @@ def test_correct_auth(client, auth):
2532
assert response.status_code == 200
2633

2734

28-
def test_incorrect_auth(client, auth, rhsso):
35+
def test_incorrect_auth(client, rhsso, user2):
2936
"""Updates RHSSO user email address and tests incorrect auth"""
30-
rhsso.user.update_user(email="updatedMail@anything.invalid")
37+
auth = HttpxOidcClientAuth(rhsso.get_token(user2.username, user2.password), "authorization")
3138
response = client.get("get", auth=auth)
3239
assert response.status_code == 403

0 commit comments

Comments
 (0)