-
Notifications
You must be signed in to change notification settings - Fork 24
/
test.py
executable file
·36 lines (26 loc) · 1.11 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
#!/usr/bin/env python
import sys
import unittest
from domainr import Domain
search_result = ['goo', 'goo.gl', 'goo.gle', 'goog', 'google', 'google.com', 'google.net', 'google.org', 'google.us']
status_result = ['\x1b[31m✗\x1b[0m goo', '\x1b[31m✗\x1b[0m goo.gl', '\x1b[31m✗\x1b[0m goo.gle',
'\x1b[31m✗\x1b[0m goog', '\x1b[31m✗\x1b[0m google', '\x1b[31m✗\x1b[0m google.com',
'\x1b[31m✗\x1b[0m google.net', '\x1b[31m✗\x1b[0m google.org', '\x1b[31m✗\x1b[0m google.us']
class TestDomain(unittest.TestCase):
def setUp(self):
sys.argv = ['core.py', 'google']
def tearDown(self):
sys.argv = []
def test_search(self):
env = Domain._get_argparser().parse_args()
domain = Domain()
result = domain.search(env)
self.assertEquals(result, search_result)
def test_status(self):
env = Domain._get_argparser().parse_args()
env.query = search_result
domain = Domain()
result = domain.status(env)
self.assertEquals(result, status_result)
if __name__ == '__main__':
unittest.main()