Skip to content

Commit

Permalink
OidcMock: allow checking mocked request handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed Oct 19, 2023
1 parent 5f27db8 commit a2ff467
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion openeo/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.24.0a2"
__version__ = "0.24.0a3"
4 changes: 3 additions & 1 deletion openeo/rest/auth/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,9 @@ class OidcClientInfo:
Simple container holding basic info of an OIDC client
"""

def __init__(self, client_id: str, provider: OidcProviderInfo, client_secret: str = None):
__slots__ = ["client_id", "provider", "client_secret"]

def __init__(self, client_id: str, provider: OidcProviderInfo, client_secret: Optional[str] = None):
self.client_id = client_id
self.provider = provider
self.client_secret = client_secret
Expand Down
11 changes: 5 additions & 6 deletions openeo/rest/auth/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,10 @@ def __init__(
self.state = state or {}
self.scopes_supported = scopes_supported or ["openid", "email", "profile"]
self.support_verification_uri_complete = support_verification_uri_complete
self.mocks = {}

oidc_discovery_url = oidc_discovery_url or url_join(
oidc_issuer, "/.well-known/openid-configuration"
)
self.requests_mock.get(
oidc_discovery_url = oidc_discovery_url or url_join(oidc_issuer, "/.well-known/openid-configuration")
self.mocks["oidc_discovery"] = self.requests_mock.get(
oidc_discovery_url,
text=json.dumps(
dict_no_none(
Expand All @@ -79,10 +78,10 @@ def __init__(
)
),
)
self.requests_mock.post(self.token_endpoint, text=self.token_callback)
self.mocks["token_endpoint"] = self.requests_mock.post(self.token_endpoint, text=self.token_callback)

if self.device_code_endpoint:
self.requests_mock.post(
self.mocks["device_code_endpoint"] = self.requests_mock.post(
self.device_code_endpoint, text=self.device_code_callback
)

Expand Down

0 comments on commit a2ff467

Please sign in to comment.