|
5 | 5 | from tests.conftest import BaseTest |
6 | 6 | from python3_capsolver.hcaptcha import HCaptcha, HCaptchaClassification |
7 | 7 | from python3_capsolver.core.enum import HCaptchaTypeEnm, HCaptchaClassificationTypeEnm |
| 8 | +from python3_capsolver.core.serializer import CaptchaResponseSer |
8 | 9 |
|
9 | 10 | HCAPTCHA_KEY = "3ceb8624-1970-4e6b-91d5-70317b70b651" |
10 | 11 | PAGE_URL = "https://accounts.hcaptcha.com/demo" |
@@ -275,6 +276,19 @@ def test_api_key_err(self): |
275 | 276 | queries=[self.image_body], |
276 | 277 | question=self.question, |
277 | 278 | ).captcha_handler() |
| 279 | + assert isinstance(result, CaptchaResponseSer) |
| 280 | + assert result.errorId == 1 |
| 281 | + assert result.errorCode == "ERROR_KEY_DENIED_ACCESS" |
| 282 | + assert not result.solution |
| 283 | + |
| 284 | + async def test_aio_api_key_err(self): |
| 285 | + result = await HCaptchaClassification( |
| 286 | + api_key=self.get_random_string(36), |
| 287 | + captcha_type=self.captcha_type, |
| 288 | + queries=[self.image_body], |
| 289 | + question=self.question, |
| 290 | + ).aio_captcha_handler() |
| 291 | + assert isinstance(result, CaptchaResponseSer) |
278 | 292 | assert result.errorId == 1 |
279 | 293 | assert result.errorCode == "ERROR_KEY_DENIED_ACCESS" |
280 | 294 | assert not result.solution |
0 commit comments