Skip to content

Commit

Permalink
if not provided, installation ID should be None
Browse files Browse the repository at this point in the history
  • Loading branch information
TrishGillett committed Aug 15, 2024
1 parent aade338 commit 86d8d4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tap_github/authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ def __init__(self, env_key: str, rate_limit_buffer: Optional[int] = None, **kwar
parts = env_key.split(";;")
self.github_app_id = parts[0]
self.github_private_key = (parts[1:2] or [""])[0].replace("\\n", "\n")
self.github_installation_id: Optional[str] = (parts[2:3] or [""])[0]
self.github_installation_id: Optional[str] = (
parts[2] if len(parts) >= 3 else None
)

self.token_expires_at: Optional[datetime] = None
self.claim_token()
Expand Down
2 changes: 1 addition & 1 deletion tap_github/tests/test_authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def test_initialization_with_2_part_env_key(self):
token_manager = AppTokenManager("12345;;key\\ncontent")
assert token_manager.github_app_id == "12345"
assert token_manager.github_private_key == "key\ncontent"
assert token_manager.github_installation_id == ""
assert token_manager.github_installation_id is None

def test_initialization_with_malformed_env_key(self):
expected_error_expression = re.escape(
Expand Down

0 comments on commit 86d8d4f

Please sign in to comment.