Skip to content

Commit a2ff467

Browse files
committed
OidcMock: allow checking mocked request handlers
1 parent 5f27db8 commit a2ff467

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

openeo/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.24.0a2"
1+
__version__ = "0.24.0a3"

openeo/rest/auth/oidc.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,9 @@ class OidcClientInfo:
326326
Simple container holding basic info of an OIDC client
327327
"""
328328

329-
def __init__(self, client_id: str, provider: OidcProviderInfo, client_secret: str = None):
329+
__slots__ = ["client_id", "provider", "client_secret"]
330+
331+
def __init__(self, client_id: str, provider: OidcProviderInfo, client_secret: Optional[str] = None):
330332
self.client_id = client_id
331333
self.provider = provider
332334
self.client_secret = client_secret

openeo/rest/auth/testing.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ def __init__(
6060
self.state = state or {}
6161
self.scopes_supported = scopes_supported or ["openid", "email", "profile"]
6262
self.support_verification_uri_complete = support_verification_uri_complete
63+
self.mocks = {}
6364

64-
oidc_discovery_url = oidc_discovery_url or url_join(
65-
oidc_issuer, "/.well-known/openid-configuration"
66-
)
67-
self.requests_mock.get(
65+
oidc_discovery_url = oidc_discovery_url or url_join(oidc_issuer, "/.well-known/openid-configuration")
66+
self.mocks["oidc_discovery"] = self.requests_mock.get(
6867
oidc_discovery_url,
6968
text=json.dumps(
7069
dict_no_none(
@@ -79,10 +78,10 @@ def __init__(
7978
)
8079
),
8180
)
82-
self.requests_mock.post(self.token_endpoint, text=self.token_callback)
81+
self.mocks["token_endpoint"] = self.requests_mock.post(self.token_endpoint, text=self.token_callback)
8382

8483
if self.device_code_endpoint:
85-
self.requests_mock.post(
84+
self.mocks["device_code_endpoint"] = self.requests_mock.post(
8685
self.device_code_endpoint, text=self.device_code_callback
8786
)
8887

0 commit comments

Comments
 (0)