55from tests .conftest import BaseTest
66from python3_capsolver .hcaptcha import HCaptcha , HCaptchaClassification
77from python3_capsolver .core .enum import HCaptchaTypeEnm , HCaptchaClassificationTypeEnm
8+ from python3_capsolver .core .serializer import CaptchaResponseSer
89
910HCAPTCHA_KEY = "3ceb8624-1970-4e6b-91d5-70317b70b651"
1011PAGE_URL = "https://accounts.hcaptcha.com/demo"
@@ -243,6 +244,15 @@ async def test_aio_params_context(self):
243244 Failed tests
244245 """
245246
247+ def test_wrong_captcha_type (self ):
248+ with pytest .raises (ValueError ):
249+ HCaptchaClassification (
250+ api_key = self .API_KEY ,
251+ captcha_type = self .get_random_string (),
252+ queries = [self .image_body ],
253+ question = self .question ,
254+ )
255+
246256 def test_no_queries (self ):
247257 with pytest .raises (TypeError ):
248258 HCaptchaClassification (
@@ -259,27 +269,26 @@ def test_no_question(self):
259269 queries = [self .image_body ],
260270 )
261271
262-
263- """
264- async def test_aio_api_key_err(self):
265- result = await HCaptchaClassification(
272+ def test_api_key_err (self ):
273+ result = HCaptchaClassification (
266274 api_key = self .get_random_string (36 ),
267275 captcha_type = self .captcha_type ,
268276 queries = [self .image_body ],
269277 question = self .question ,
270- ).aio_captcha_handler()
278+ ).captcha_handler ()
279+ assert isinstance (result , CaptchaResponseSer )
271280 assert result .errorId == 1
272281 assert result .errorCode == "ERROR_KEY_DENIED_ACCESS"
273282 assert not result .solution
274283
275- def test_api_key_err (self):
276- result = HCaptchaClassification(
284+ async def test_aio_api_key_err (self ):
285+ result = await HCaptchaClassification (
277286 api_key = self .get_random_string (36 ),
278287 captcha_type = self .captcha_type ,
279288 queries = [self .image_body ],
280289 question = self .question ,
281- ).captcha_handler()
290+ ).aio_captcha_handler ()
291+ assert isinstance (result , CaptchaResponseSer )
282292 assert result .errorId == 1
283293 assert result .errorCode == "ERROR_KEY_DENIED_ACCESS"
284294 assert not result .solution
285- """
0 commit comments