| 69 | |
| 70 | @responses.activate |
| 71 | def test_github_rate_limit_reached(): |
| 72 | responses.add( |
| 73 | responses.GET, |
| 74 | "https://api.github.com/repos/psf/requests", |
| 75 | headers={ |
| 76 | "X-Ratelimit-Remaining": "0", |
| 77 | "X-Ratelimit-Reset": "666" |
| 78 | }, |
| 79 | status=403 |
| 80 | ) |
| 81 | |
| 82 | assert github.GitHub.x_api_reset is None |
| 83 | assert github.GitHub.x_api_remaining is None |
| 84 | |
| 85 | with pytest.raises(exceptions.RateLimitError): |
| 86 | _ = github.GitHub.from_url("https://github.com/psf/requests") |
| 87 | |
| 88 | assert github.GitHub.x_api_reset == 666 |
| 89 | assert github.GitHub.x_api_remaining == 0 |