-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
66 lines (55 loc) · 21.6 KB
/
test.py
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
import logging
import unittest
from captcha import Captcha
class TestCaptcha(unittest.TestCase):
def setUp(self):
self.className = 'CaptchaTest'
l = logging.getLogger(self.className)
l.setLevel(logging.ERROR)
self.captcha = Captcha(logger = l)
def testLoggerEmptyLogger(self):
captcha = Captcha()
logger = captcha.logger
self.assertEqual(logger.name, 'Captcha')
def testLoggerExistingLogger(self):
logger = self.captcha.logger
self.assertEqual(logger.name, self.className)
def testLoggerExistingLoggerAndChangeLevel(self):
logger = self.captcha.logger
self.captcha.initializeLogger(logger=logger, level=logging.DEBUG)
self.assertEqual(logging.DEBUG, self.captcha.logger.level)
def testFilter_allowed_characters01(self):
testString = '0123456789abcdefghijklmnopqrstuvwxyz'
test = self.captcha.filter_allowed_characters(text=testString)
self.assertEqual(test, testString)
def testFilter_allowed_characters02(self):
testString = '0123456789abcdefghijklmnopqrstuvwxyz '
test = self.captcha.filter_allowed_characters(text=testString)
self.assertEqual(test, '0123456789abcdefghijklmnopqrstuvwxyz')
def testFilter_allowed_characters03(self):
testString = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%¨&*()êâîôûÂÊÎ'
test = self.captcha.filter_allowed_characters(text=testString)
self.assertEqual(test, '0123456789abcdefghijklmnopqrstuvwxyz')
def testSolve01(self):
captcha = Captcha()
imgstring = b'/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj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XULQ3EMc0TY3JIoZTg55B96xPBdxPdeErGa4mkmlbzNzyMWY4kYck+1AG/RRRQAUUVzmu/vvE+gWUvz2k/2jzoG5STagK7l6HB5GehoA1JNQM8r2+nKs8qkpJNkGKBvRuclhz8o56Z2gg1YtbVLWIqpZ2Y7pJH5aRv7xPrwB6AAAAAAVLHGkMSRRIqRoAqqowFA6ADsKdQAUUUUAf/Z'
captcha.create_img_file(imgstring=imgstring)
text = captcha.solver()
text = captcha.filter_allowed_characters(text=text)
self.assertEqual(text, '2hnwjd')
def testSolve02(self):
captcha = Captcha()
imgstring = b'/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCABaASwDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanq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R0y2c84AB+YADfDr/aLS7u1ljeG4vZmiEQ+RVDFOOTncULkjqXJrXpscccMSRRIqRooVUUYCgdAB2FOoAp6mbWOxee7m8iOH94JgcNG3QEe/OMc5zjBBwcuwaSxmfUNcgjgu50UPciQGGJe0fJynOSeqkn7xJAF6ZTea0kDOyw2kaTmMYIlZiwXPH8Owke5B/hrSoAjguIbqFZreWOWJvuvGwZT24IqSqc+k6fczNPLZQNO3/LbYBICOAQw5BHGCDkYqP8AsPTm/wBdb/avT7W7T7fpvJx7464HpQBJPqlrDM1usnnXQ/5d4fnkGemQPujkfM2ByMkUQW80sy3N6I/NT/VxRsWSLsSCQMseecDAOB3LWILeG1hWG3ijiiX7qRqFUd+AKkoAKx7xP7IuDqcLbLM/8fkCRZzk/wCtAHO4E/MecqPVRWxRQAUVm6Ugs2uNNBbZbFTAGYsfKYccn0YOoHUBR9TpUAFFFFAGZd/6Nrdldn5YZUe1kYcfMSrRlvYEOo/2pAB941p1meI/+RY1b/rym/8AQDWnQAUUUUANkkjhieWV1SNFLM7HAUDqSewrO0T99azX/wDz/TNOuOhTASMgdRmNEJB5yT06A17nTFQ8rJc28br2ZWmRWU+oIJBHcE1p0AFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAGXpKrJc6pdiHZ512UVyBuYRqsfbtuV8Z/rWpWfo3/AB4yf9fdz/6OetCgAooooAKKKKACiiigDPP7rxCm3/l4tG357eW424/7+tn6D8dCs/Uf+P7Sf+vtv/RMtaFAH//Z'
captcha.create_img_file(imgstring=imgstring)
text = captcha.solver()
text = captcha.filter_allowed_characters(text=text)
self.assertEqual(text, 'vfn4s8')
def testSolve03(self):
captcha = Captcha()
imgstring = b'/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRw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bqMjg46igDp6zLf/iZait+ObOFCtqe0jt96QD0xhVbjIZ+qsCfNfh9cz69r89rrE8mo26WrSLFeOZkDhkAYBsjOCRn3Neu0AFFFFABRRRQAUUUUAf/Z'
captcha.create_img_file(imgstring=imgstring)
text = captcha.solver()
text = captcha.filter_allowed_characters(text=text)
self.assertEqual(text, '8bd55n')
if __name__ == '__main__':
unittest.main() # pragma: no cover