forked from 2captcha/2captcha-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_normal.py
More file actions
102 lines (56 loc) · 2.15 KB
/
test_normal.py
File metadata and controls
102 lines (56 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env python3
import unittest
file = '../examples/images/normal.jpg'
hint_img = '../examples/images/grid_hint.jpg'
try:
from .abstract import AbstractTest
file = file[3:]
hint_img = hint_img[3:]
except ImportError:
from abstract import AbstractTest
class NormalTest(AbstractTest):
def test_file(self):
sends = {'method': 'post', 'file': file}
return self.send_return(sends, self.solver.normal, file=file)
# def test_file_params(self):
# return self.test_send_return(self.method, self.file, method='post')
def test_base64(self):
b64 = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'
sends = {
'method': 'base64',
'body' : b64,
}
return self.send_return(sends, self.solver.normal, file=b64)
def test_all_params(self):
params = {
'numeric' : 4,
'minLen' : 4,
'maxLen' : 20,
'phrase' : 1,
'caseSensitive' : 1,
'calc' : 0,
'lang' : 'en',
'hintImg' : hint_img,
'hintText' : 'Type red symbols only',
}
sends = {
'files' : {'file': file,'imginstructions': hint_img},
'method' : 'post',
'numeric' : 4,
'min_len' : 4,
'max_len' : 20,
'phrase' : 1,
'regsense' : 1,
'calc' : 0,
'lang' : 'en',
'textinstructions' : 'Type red symbols only',
}
# files = {
# 'file' : file,
# 'imginstructions' : hint,
# }
return self.send_return(sends, self.solver.normal, file=file, **params)
def test_not_found(self):
return self.invalid_file(self.solver.normal)
if __name__ == '__main__':
unittest.main()