|
6 | 6 |
|
7 | 7 | from cryptography.hazmat.primitives import asymmetric, serialization |
8 | 8 |
|
9 | | -from ... import Auth0Error |
| 9 | +from ...exceptions import RateLimitError |
10 | 10 | from ...authentication.get_token import GetToken |
11 | 11 |
|
12 | 12 |
|
@@ -339,22 +339,22 @@ def test_backchannel_login(self, mock_post): |
339 | 339 | ) |
340 | 340 |
|
341 | 341 | @mock.patch("requests.request") |
342 | | - def test_backchannel_login_headers_on_failure(self, mock_requests_request): |
| 342 | + def test_backchannel_login_headers_on_slow_down(self, mock_requests_request): |
343 | 343 | response = requests.Response() |
344 | | - response.status_code = 400 |
| 344 | + response.status_code = 429 |
345 | 345 | response.headers = {"Retry-After": "100"} |
346 | 346 | response._content = b'{"error":"slow_down"}' |
347 | 347 | mock_requests_request.return_value = response |
348 | 348 |
|
349 | 349 | g = GetToken("my.domain.com", "cid", client_secret="csec") |
350 | 350 |
|
351 | | - with self.assertRaises(Auth0Error) as context: |
| 351 | + with self.assertRaises(RateLimitError) as context: |
352 | 352 | g.backchannel_login( |
353 | 353 | auth_req_id="reqid", |
354 | 354 | grant_type="urn:openid:params:grant-type:ciba", |
355 | 355 | ) |
356 | 356 | self.assertEqual(context.exception.headers["Retry-After"], "100") |
357 | | - self.assertEqual(context.exception.status_code, 400) |
| 357 | + self.assertEqual(context.exception.status_code, 429) |
358 | 358 |
|
359 | 359 | @mock.patch("auth0.rest.RestClient.post") |
360 | 360 | def test_connection_login(self, mock_post): |
|
0 commit comments