Skip to content

Commit

Permalink
check error message more idiomatically
Browse files Browse the repository at this point in the history
  • Loading branch information
TrishGillett committed Aug 9, 2024
1 parent 4d49dd0 commit 0aa5771
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tap_github/tests/test_authenticator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest
import requests
import re
from singer_sdk.streams import RESTStream

from tap_github.authenticator import (
Expand Down Expand Up @@ -137,13 +138,13 @@ def test_initialization_with_2_part_env_key(self):
assert token_manager.github_installation_id == ""

def test_initialization_with_malformed_env_key(self):
with pytest.raises(ValueError) as exc_info:
AppTokenManager("12345key\\ncontent")

assert str(exc_info.value) == (
"GITHUB_APP_PRIVATE_KEY could not be parsed. The expected format is "
expected_error_expression = re.escape(
'GITHUB_APP_PRIVATE_KEY could not be parsed. The expected format is '
'":app_id:;;-----BEGIN RSA PRIVATE KEY-----\\n_YOUR_P_KEY_\\n-----END RSA PRIVATE KEY-----"'
)
with pytest.raises(ValueError, match=expected_error_expression):
AppTokenManager("12345key\\ncontent")


def test_generate_token_with_invalid_credentials(self):
with patch.object(AppTokenManager, "is_valid_token", return_value=False), patch(
Expand Down

0 comments on commit 0aa5771

Please sign in to comment.