feat: expand registry ingestion and demo exchange
This commit is contained in:
@@ -493,6 +493,41 @@ class CheckoClientApiTest(SimpleTestCase):
|
||||
)
|
||||
)
|
||||
|
||||
def test_http_403_quota_error_keeps_checko_rate_limit_classification(self):
|
||||
with TestHTTPServer() as server:
|
||||
server.add_json(
|
||||
"/v2/company",
|
||||
{
|
||||
"meta": {
|
||||
"status": "error",
|
||||
"message": (
|
||||
"Превышен суточный лимит запросов для бесплатного тарифа"
|
||||
),
|
||||
"balance": 0,
|
||||
"today_request_count": 100,
|
||||
}
|
||||
},
|
||||
status=403,
|
||||
)
|
||||
client = _client_for(server)
|
||||
with self.assertRaises(CheckoRateLimitError) as context:
|
||||
client.get_company(CompanyRequest(inn=_digits(10)))
|
||||
|
||||
self.assertEqual(context.exception.status_code, 403)
|
||||
self.assertEqual(context.exception.balance, 0)
|
||||
self.assertEqual(context.exception.request_count, 100)
|
||||
|
||||
def test_non_quota_http_error_remains_connection_error(self):
|
||||
with TestHTTPServer() as server:
|
||||
server.add_json(
|
||||
"/v2/company",
|
||||
{"meta": {"status": "error", "message": "Доступ запрещён"}},
|
||||
status=403,
|
||||
)
|
||||
client = _client_for(server)
|
||||
with self.assertRaises(CheckoConnectionError):
|
||||
client.get_company(CompanyRequest(inn=_digits(10)))
|
||||
|
||||
def test_not_found_error_handling(self):
|
||||
with TestHTTPServer() as server:
|
||||
server.add_json(
|
||||
|
||||
Reference in New Issue
Block a user