-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync openid-connect branch with main
- Loading branch information
Showing
35 changed files
with
150 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,6 @@ | |
Metadata, | ||
MetadataBadValue, | ||
MetadataError, | ||
User, | ||
) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
|
||
from pbench.client import PbenchServerClient | ||
from pbench.client.oidc_admin import OIDCAdmin | ||
from pbench.server.auth import OpenIDClientError | ||
|
||
USERNAME: str = "tester" | ||
EMAIL: str = "[email protected]" | ||
|
@@ -35,31 +36,36 @@ def server_client(): | |
def oidc_admin(server_client: PbenchServerClient): | ||
""" | ||
Used by Pbench Server functional tests to get admin access | ||
on OIDC server. | ||
on the test OIDC server. | ||
""" | ||
return OIDCAdmin(server_url=server_client.endpoints["openid"]["server"]) | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def register_test_user(oidc_admin: OIDCAdmin): | ||
"""Create a test user for functional tests.""" | ||
response = oidc_admin.create_new_user( | ||
username=USERNAME, | ||
email=EMAIL, | ||
password=PASSWORD, | ||
first_name=FIRST_NAME, | ||
last_name=LAST_NAME, | ||
) | ||
|
||
# To allow testing outside our transient CI containers, allow the tester | ||
# user to already exist. | ||
assert ( | ||
response.ok or response.status_code == HTTPStatus.CONFLICT | ||
), f"Register failed with {response.json()}" | ||
try: | ||
response = oidc_admin.create_new_user( | ||
username=USERNAME, | ||
email=EMAIL, | ||
password=PASSWORD, | ||
first_name=FIRST_NAME, | ||
last_name=LAST_NAME, | ||
) | ||
except OpenIDClientError as e: | ||
# To allow testing outside our transient CI containers, allow the tester | ||
# user to already exist. | ||
if e.http_status != HTTPStatus.CONFLICT: | ||
raise e | ||
pass | ||
else: | ||
assert response.ok, f"Register failed with {response.json()}" | ||
|
||
|
||
@pytest.fixture | ||
def login_user(server_client: PbenchServerClient, register_test_user): | ||
"""Log in the test user and return the authentication token""" | ||
server_client.login(USERNAME, PASSWORD) | ||
assert server_client.auth_token | ||
yield | ||
server_client.auth_token = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.