Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit f4b4729

Browse files
committed
IDP-43-modular: code copilot feedbaack
1 parent 30d5a15 commit f4b4729

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

cpk_lib_python_github/github_app_token_generator_package/github_app_token_generator/github_api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ def revoke_installation_token(self, token: str) -> bool:
148148
return True
149149

150150
except requests.exceptions.HTTPError as http_error:
151-
if response.status_code == 404:
151+
if (
152+
http_error.response is not None
153+
and http_error.response.status_code == 404
154+
):
152155
logger.warning("Token not found or already revoked")
153156
return False
154157
logger.error("HTTP error occurred while revoking token: %s", http_error)

cpk_lib_python_github/github_app_token_generator_package/tests/test_github_api.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ def test_get_installation_access_token_connection_error(
172172
self, github_api_client, sample_jwt_token, sample_installation_id
173173
):
174174
"""Test connection error (no mock response registered)."""
175-
# Don't register any mock response to simulate connection error
176175

177176
with pytest.raises(requests.exceptions.RequestException):
178177
github_api_client.get_installation_access_token(
@@ -255,7 +254,6 @@ def test_list_installations_network_error(
255254
self, github_api_client, sample_jwt_token
256255
):
257256
"""Test installations listing with network error."""
258-
# Don't add any responses to simulate network error
259257

260258
with pytest.raises(requests.exceptions.RequestException):
261259
github_api_client.list_installations(sample_jwt_token)
@@ -373,7 +371,6 @@ def test_validate_token_network_error(
373371
self, github_api_client, sample_installation_token
374372
):
375373
"""Test token validation with network error."""
376-
# Don't add any responses to simulate network error
377374

378375
result = github_api_client.validate_token(sample_installation_token)
379376

@@ -458,7 +455,6 @@ def test_revoke_installation_token_network_error(
458455
self, github_api_client, sample_installation_token
459456
):
460457
"""Test token revocation with network error."""
461-
# Don't add any responses to simulate network error
462458

463459
with pytest.raises(requests.exceptions.RequestException):
464460
github_api_client.revoke_installation_token(sample_installation_token)
@@ -753,7 +749,6 @@ def test_get_accessible_repositories_via_token_network_error(
753749
self, github_api_client, sample_installation_token
754750
):
755751
"""Test repositories retrieval via token with network error."""
756-
# Don't add any responses to simulate network error
757752

758753
repos = github_api_client.get_accessible_repositories_via_token(
759754
sample_installation_token

0 commit comments

Comments
 (0)