|
1 | 1 | import logging |
| 2 | +from unittest.mock import Mock, patch |
2 | 3 |
|
3 | 4 | import pytest |
4 | | -from jira.exceptions import JIRAError |
| 5 | +from requests import Response |
5 | 6 |
|
6 | 7 | import jira.resilientsession |
| 8 | +from jira.exceptions import JIRAError |
7 | 9 | from tests.conftest import JiraTestCase |
8 | | -from requests import Response |
9 | | -from unittest.mock import Mock, patch |
10 | 10 |
|
11 | 11 |
|
12 | 12 | class ListLoggingHandler(logging.Handler): |
@@ -59,13 +59,15 @@ def tearDown(self): |
59 | 59 | jira.resilientsession.logging.getLogger().removeHandler(self.loggingHandler) |
60 | 60 | del self.loggingHandler |
61 | 61 |
|
62 | | - |
| 62 | + |
63 | 63 | @patch("requests.Session.get") |
64 | 64 | def test_throttling_error_is_retried(mocked_method: Mock): |
65 | | - mocked_throttled_response : Response = Response() |
| 65 | + mocked_throttled_response: Response = Response() |
66 | 66 | mocked_throttled_response.status_code = 429 |
67 | 67 | mocked_method.return_value = mocked_throttled_response |
68 | | - session : jira.resilientsession.ResilientSession = jira.resilientsession.ResilientSession() |
| 68 | + session: jira.resilientsession.ResilientSession = ( |
| 69 | + jira.resilientsession.ResilientSession() |
| 70 | + ) |
69 | 71 | with pytest.raises(JIRAError): |
70 | | - session.get('mocked_url') |
| 72 | + session.get("mocked_url") |
71 | 73 | assert mocked_method.call_count == 4 |
0 commit comments