From 27358ca0c946f2cc69cfc1c39ce4f3e948a061a9 Mon Sep 17 00:00:00 2001 From: Peter Van Bouwel Date: Tue, 31 Mar 2026 08:10:11 +0200 Subject: [PATCH 1/2] test: OidcMock: allow mocking expires_in --- openeo/_version.py | 2 +- openeo/rest/auth/testing.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/openeo/_version.py b/openeo/_version.py index 2fde8a9cc..96dd8db19 100644 --- a/openeo/_version.py +++ b/openeo/_version.py @@ -1 +1 @@ -__version__ = "0.49.0a3" +__version__ = "0.49.0a4" diff --git a/openeo/rest/auth/testing.py b/openeo/rest/auth/testing.py index 81c5dbccc..b083b60d2 100644 --- a/openeo/rest/auth/testing.py +++ b/openeo/rest/auth/testing.py @@ -40,6 +40,7 @@ def __init__( device_code_flow_support: bool = True, oidc_discovery_url: Optional[str] = None, support_verification_uri_complete: bool = False, + access_token_expires_in: int = 3600, ): self.requests_mock = requests_mock self.oidc_issuer = oidc_issuer @@ -54,6 +55,7 @@ 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.access_token_expires_in = access_token_expires_in self.mocks = {} oidc_discovery_url = oidc_discovery_url or url_join(oidc_issuer, "/.well-known/openid-configuration") @@ -258,6 +260,7 @@ def _build_token_response( res = { "token_type": "Bearer", "access_token": access_token, + "expires_in": self.access_token_expires_in, } # Attempt to simulate real world refresh token support. From 63ac3877c291651fa5ad86907831fbc40596e163 Mon Sep 17 00:00:00 2001 From: Stefaan Lippens Date: Tue, 31 Mar 2026 09:15:19 +0200 Subject: [PATCH 2/2] OidcMock make access_token_expires_in optional #882 --- openeo/rest/auth/testing.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openeo/rest/auth/testing.py b/openeo/rest/auth/testing.py index b083b60d2..82534d6ba 100644 --- a/openeo/rest/auth/testing.py +++ b/openeo/rest/auth/testing.py @@ -7,7 +7,7 @@ import json import urllib.parse import uuid -from typing import List, Optional +from typing import Dict, List, Optional, Union import requests import requests_mock.request @@ -40,7 +40,7 @@ def __init__( device_code_flow_support: bool = True, oidc_discovery_url: Optional[str] = None, support_verification_uri_complete: bool = False, - access_token_expires_in: int = 3600, + access_token_expires_in: Optional[int] = None, ): self.requests_mock = requests_mock self.oidc_issuer = oidc_issuer @@ -257,11 +257,12 @@ def _build_token_response( _uuid=uuid.uuid4().hex, ), ) - res = { + res: Dict[str, Union[str, int, float]] = { "token_type": "Bearer", "access_token": access_token, - "expires_in": self.access_token_expires_in, } + if self.access_token_expires_in is not None: + res["expires_in"] = self.access_token_expires_in # Attempt to simulate real world refresh token support. if include_refresh_token is None: