File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,16 @@ def test_captcha_handler_exist(self):
1616 def test_aio_captcha_handler_exist (self ):
1717 assert "aio_captcha_handler" in DatadomeSlider .__dict__ .keys ()
1818
19+ def test_wrong_captcha_type (self ):
20+ with pytest .raises (ValueError ):
21+ DatadomeSlider (
22+ api_key = self .API_KEY ,
23+ captcha_type = self .get_random_string (36 ),
24+ websiteURL = websiteURL ,
25+ captchaUrl = captchaUrl ,
26+ userAgent = self .get_random_string (36 ),
27+ )
28+
1929
2030class TestDatadomeSlider (BaseTest ):
2131 """
Original file line number Diff line number Diff line change 11import base64
22
3+ import pytest
4+
35from tests .conftest import BaseTest
46from python3_capsolver .core .enum import ResponseStatusEnm
57from python3_capsolver .image_to_text import ImageToText
911 img_data = img_file .read ()
1012
1113
12- class TestImageToText (BaseTest ):
13- image_body = base64 .b64encode (img_data ).decode ("utf-8" )
14- """
15- Success tests
16- """
17-
14+ class TestImageToTextBase (BaseTest ):
1815 def test_captcha_handler_exist (self ):
1916 assert "captcha_handler" in ImageToText .__dict__ .keys ()
2017
2118 def test_aio_captcha_handler_exist (self ):
2219 assert "aio_captcha_handler" in ImageToText .__dict__ .keys ()
2320
21+ def test_wrong_captcha_type (self ):
22+ with pytest .raises (ValueError ):
23+ ImageToText (api_key = self .API_KEY , captcha_type = self .get_random_string ())
24+
25+
26+ class TestImageToText (BaseTest ):
27+ image_body = base64 .b64encode (img_data ).decode ("utf-8" )
28+ """
29+ Success tests
30+ """
31+
2432 def test_solve_image (self ):
2533 resp = ImageToText (api_key = self .API_KEY ).captcha_handler (body = self .image_body )
2634 assert isinstance (resp , CaptchaResponseSer )
Original file line number Diff line number Diff line change @@ -19,6 +19,16 @@ def test_captcha_handler_exist(self):
1919 def test_aio_captcha_handler_exist (self ):
2020 assert "aio_captcha_handler" in MtCaptcha .__dict__ .keys ()
2121
22+ def test_wrong_captcha_type (self ):
23+ with pytest .raises (ValueError ):
24+ MtCaptcha (
25+ api_key = self .API_KEY ,
26+ captcha_type = self .get_random_string (),
27+ websiteKey = websiteKey ,
28+ proxy = proxy ,
29+ websiteURL = websiteURL ,
30+ )
31+
2232 @pytest .mark .parametrize ("captcha_type" , captcha_types )
2333 def test_no_website_url (self , captcha_type : str ):
2434 with pytest .raises (TypeError ):
You can’t perform that action at this time.
0 commit comments