Skip to content

Commit

Permalink
Issue #237 python3.6 compatibilty fix
Browse files Browse the repository at this point in the history
  • Loading branch information
soxofaan committed May 3, 2023
1 parent 438cc69 commit 00e5cdb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion openeo/rest/auth/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
14 changes: 4 additions & 10 deletions tests/rest/auth/test_oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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,
)
Expand Down Expand Up @@ -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"], [
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 00e5cdb

Please sign in to comment.