From 00e5cdbcba356be0d1f0295a04e32ae67bcfff68 Mon Sep 17 00:00:00 2001 From: Stefaan Lippens Date: Wed, 3 May 2023 09:26:17 +0200 Subject: [PATCH] Issue #237 python3.6 compatibilty fix --- openeo/rest/auth/oidc.py | 2 +- tests/rest/auth/test_oidc.py | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/openeo/rest/auth/oidc.py b/openeo/rest/auth/oidc.py index 5200451ec..36bb4ae27 100644 --- a/openeo/rest/auth/oidc.py +++ b/openeo/rest/auth/oidc.py @@ -858,7 +858,7 @@ def get_tokens(self, request_refresh_token: bool = False) -> AccessTokenResult: error = resp.json()["error"] except Exception: error = "unknown" - log.info(f"[{elapsed():5.1f}s] not authorized yet: {error=}") + log.info(f"[{elapsed():5.1f}s] not authorized yet: {error}") if error == "authorization_pending": poll_ui.show_progress(status="Authorization pending") elif error == "slow_down": diff --git a/tests/rest/auth/test_oidc.py b/tests/rest/auth/test_oidc.py index de731a4b4..418c0e29e 100644 --- a/tests/rest/auth/test_oidc.py +++ b/tests/rest/auth/test_oidc.py @@ -411,9 +411,7 @@ def test_oidc_device_flow_with_client_secret(requests_mock, caplog, support_veri (1011, "", "\n"), ] - assert re.search( - r"error='authorization_pending'.*error='slow_down'.*Authorized successfully", caplog.text, flags=re.DOTALL - ) + assert re.search(r"authorization_pending.*slow_down.*Authorized successfully", caplog.text, flags=re.DOTALL) @pytest.mark.parametrize("support_verification_uri_complete", [False, True]) @@ -482,7 +480,7 @@ def test_oidc_device_flow_with_pkce(requests_mock, caplog, support_verification_ ] assert re.search( - r"error='authorization_pending'.*error='authorization_pending'.*Authorized successfully", + r"authorization_pending.*authorization_pending.*Authorized successfully", caplog.text, flags=re.DOTALL, ) @@ -558,9 +556,7 @@ def test_oidc_device_flow_without_pkce_nor_secret( (1043.5, "", "\n"), ] - assert re.search( - r"error='authorization_pending'.*error='slow_down'.*Authorized successfully", caplog.text, flags=re.DOTALL - ) + assert re.search(r"authorization_pending.*slow_down.*Authorized successfully", caplog.text, flags=re.DOTALL) @pytest.mark.parametrize(["mode", "client_id", "use_pkce", "client_secret", "expected_fields"], [ @@ -682,9 +678,7 @@ def test_oidc_device_flow_auto_detect( (1033, "", "\n"), ] - assert re.search( - r"error='authorization_pending'.*error='slow_down'.*Authorized successfully", caplog.text, flags=re.DOTALL - ) + assert re.search(r"authorization_pending.*slow_down.*Authorized successfully", caplog.text, flags=re.DOTALL) def test_oidc_refresh_token_flow(requests_mock, caplog):