-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
32cba84
commit 5f89514
Showing
3 changed files
with
24 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ pream-team = "pream_team.__main__:main" | |
|
||
[project] | ||
name = "pream-team" | ||
version = "0.0.3" | ||
version = "1.0.0" | ||
authors = [ | ||
{ name="Nikola Dućak", email="[email protected]" }, | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pytest | ||
import time | ||
from pream_team.github_pr_fetcher import GitHubPRFetcher, GITHUB_API_URL | ||
from aioresponses import aioresponses | ||
|
||
@pytest.mark.asyncio | ||
async def test_primary_rate_limit_handling(): | ||
github_token = "fake-token" | ||
|
||
with aioresponses() as m: | ||
mock_url_with_query = "https://api.github.com/search/issues?q=author:testuser+type:pr+is:open+created:2024-02-03..2024-02-10" | ||
m.get(mock_url_with_query, status=403, headers={"X-RateLimit-Remaining": "0", "X-RateLimit-Reset": str(int(time.time()) + 1)}, payload={"message": "Rate limit exceeded"}) | ||
|
||
mock_prs = ["one", "two"] | ||
m.get(mock_url_with_query, payload={"items": mock_prs}) # Assuming a successful empty response | ||
|
||
async with GitHubPRFetcher(github_token) as fetcher: | ||
status_reporter = lambda _: None | ||
prs = await fetcher.get_open_prs_for_user("testuser", None, 7, status_reporter) | ||
assert prs == mock_prs, "Expected an empty list of PRs after handling rate limit." | ||
|
||
|