Skip to content

Commit f43b0cc

Browse files
author
Andrei
committed
Update tests and gitignore
1 parent 901ee7c commit f43b0cc

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ __pycache__/
1616
*.xml
1717

1818
dist/
19+
20+
env/

tests/test_Control.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ def test_params(self):
6464
assert default_complaint_params == complaint_params[0]
6565
assert default_queue_status_params == queue_status_params[0]
6666

67+
"""
68+
Request payload test MOCK
69+
"""
70+
6771
def test_balance_payload(self):
6872
control = AntiCaptchaControl.AntiCaptchaControl(anticaptcha_key=self.anticaptcha_key_true)
6973
# check response type
@@ -133,8 +137,7 @@ def test_complaint_re_payload(self):
133137
# check response type
134138
assert isinstance(control, AntiCaptchaControl.AntiCaptchaControl)
135139
task_id = 123456
136-
print(config.incorrect_recaptcha_url)
137-
print(AntiCaptchaControl.complaint_types[1])
140+
138141
with requests_mock.Mocker() as req_mock:
139142
req_mock.post(config.incorrect_recaptcha_url, json=self.ERROR_RESPONSE_JSON)
140143
control.complaint_on_result(
@@ -152,6 +155,22 @@ def test_complaint_re_payload(self):
152155
assert request_payload["clientKey"] == self.anticaptcha_key_true
153156
assert request_payload["taskId"] == task_id
154157

158+
def test_queue_payload(self):
159+
queue_id = random.choice(AntiCaptchaControl.queue_ids)
160+
with requests_mock.Mocker() as req_mock:
161+
req_mock.post(config.get_queue_status_url, json=self.ERROR_RESPONSE_JSON)
162+
AntiCaptchaControl.AntiCaptchaControl.get_queue_status(queue_id)
163+
164+
history = req_mock.request_history
165+
166+
assert len(history) == 1
167+
168+
request_payload = history[0].json()
169+
170+
# check all dict keys
171+
assert ["queueId",] == list(request_payload.keys())
172+
assert request_payload["queueId"] == queue_id
173+
155174
"""
156175
Response checking
157176
"""

0 commit comments

Comments
 (0)