(self, *args, **kwargs)
| 30 | return False |
| 31 | |
| 32 | async def post(self, *args, **kwargs): |
| 33 | self._calls += 1 |
| 34 | response = MagicMock() |
| 35 | if self._calls == 1: |
| 36 | # createTask |
| 37 | response.status_code = 200 |
| 38 | response.json.return_value = { |
| 39 | "errorId": 0, |
| 40 | "taskId": "tid-xyz", |
| 41 | } |
| 42 | else: |
| 43 | # getTaskResult |
| 44 | response.status_code = 200 |
| 45 | response.json.return_value = { |
| 46 | "errorId": 0, |
| 47 | "status": "ready", |
| 48 | "solution": { |
| 49 | "gRecaptchaResponse": "token-abc", |
| 50 | "userAgent": ( |
| 51 | "Mozilla/5.0 (Windows NT 10.0; Win64; x64) " |
| 52 | "AppleWebKit/537.36 (KHTML, like Gecko) " |
| 53 | "Chrome/147.0.0.0 Safari/537.36" |
| 54 | ), |
| 55 | }, |
| 56 | } |
| 57 | return response |
| 58 | |
| 59 | |
| 60 | class ApiCaptchaFingerprintTests(unittest.IsolatedAsyncioTestCase): |
no outgoing calls
no test coverage detected