Skip to content

Commit

Permalink
chore: publish to pypi (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaDucak authored Feb 10, 2024
1 parent 32cba84 commit 5f89514
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ A TUI utility that lists open github PRs for your team.
![banner](./banner.png)

# Get it
As it's early in the development stages, it's currently only availabe on the test pypy:
```
python3 -m pip install --index-url https://test.pypi.org/simple/ pream-team --upgrade
python3 -m pip install pream-team --upgrade
```


# How to
You need a GitHub personal access token with full repo scope
and with admin org read access if you want to specify `org` value.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]" },
]
Expand Down
22 changes: 22 additions & 0 deletions test/github_pr_fetcher_test.py
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."


0 comments on commit 5f89514

Please sign in to comment.