Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions gittensor/utils/github_api_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ def get_github_identity(token: str) -> GitHubIdentityResult:
return GitHubIdentityResult(None, GitHubIdentityStatus.TRANSIENT_FAILURE)


def get_github_id(token: str) -> Optional[str]:
"""Get GitHub numeric user id (as string) using a PAT."""
return get_github_identity(token).github_id


# GraphQL fragment used by both issue submissions and solver detection.
_PR_TIMELINE_QUERY = """
query($owner: String!, $name: String!, $issueNumber: Int!) {
Expand Down
21 changes: 0 additions & 21 deletions tests/utils/test_github_api_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
)

get_github_identity = github_api_tools.get_github_identity
get_github_id = github_api_tools.get_github_id
find_prs_for_issue = github_api_tools.find_prs_for_issue
execute_graphql_query = github_api_tools.execute_graphql_query
check_github_issue_closed = github_api_tools.check_github_issue_closed
Expand All @@ -34,26 +33,6 @@
class TestOtherGitHubAPIFunctions:
"""Test suite for other GitHub API functions with existing retry logic."""

@patch('gittensor.utils.github_api_tools.requests.get')
@patch('gittensor.utils.github_api_tools.time.sleep')
@patch('gittensor.utils.github_api_tools.bt.logging')
def test_get_github_id_retry_logic(self, mock_logging, mock_sleep, mock_get):
"""Test that get_github_id retries on failure."""
mock_response_success = Mock()
mock_response_success.status_code = 200
mock_response_success.json.return_value = {'id': 12345}

mock_get.side_effect = [
Exception('Timeout'),
Exception('Timeout'),
mock_response_success,
]

result = get_github_id('fake_token')

assert result == '12345'
assert mock_get.call_count == 3

@patch('gittensor.utils.github_api_tools.requests.get')
@patch('gittensor.utils.github_api_tools.time.sleep')
@patch('gittensor.utils.github_api_tools.bt.logging')
Expand Down
Loading