async def test_fail_aioresult_handler(self):
        # prepare client
        custom_result = CustomResultHandler.aioCustomResultHandler(
            anticaptcha_key=self.anticaptcha_key_fail)

        response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID)
        # check error code
        assert 1 == response["errorId"]
Esempio n. 2
0
async def run():
    try:
        # io.IOBase
        custom_result = CustomResultHandler.aioCustomResultHandler(
            anticaptcha_key=ANTICAPTCHA_KEY)
        response = await custom_result.task_handler(task_id=TASK_ID)
        print(response)
    except Exception as err:
        print(err)
Esempio n. 3
0
    async def test_true_aioresult_handler_context(self):
        # prepare client
        with CustomResultHandler.aioCustomResultHandler(
            anticaptcha_key=self.anticaptcha_key_true
        ) as custom_result:

            response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID)
            # check error code
            assert 16 == response["errorId"]
    async def test_response_aioresult_handler(self):
        # prepare client
        custom_result = CustomResultHandler.aioCustomResultHandler(
            anticaptcha_key=self.anticaptcha_key_true
        )
        # check response type
        assert isinstance(custom_result, CustomResultHandler.aioCustomResultHandler)

        response = await custom_result.task_handler(task_id=self.WRONG_TASK_ID)
        # check response type
        assert isinstance(response, dict)
        # check all dict keys
        assert ["errorId", "errorCode", "errorDescription", "taskId"] == list(response.keys())