forked from Aabyss-Team/ARL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_fetch_site.py
29 lines (23 loc) · 986 Bytes
/
test_fetch_site.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
import unittest
from app import services
class TestDomain(unittest.TestCase):
def test_fetch_site(self):
sites = ["https://www.baidu.com"]
data = services.fetch_site(sites, concurrency=2)
self.assertTrue(len(data) >= 1)
self.assertTrue(len(data[0]["finger"]) >= 3)
self.assertTrue(len(data[0]["favicon"]["data"]) >= 10)
self.assertTrue(data[0]["favicon"]["hash"] == -1588080585)
def test_example(self):
sites = ["https://www.example.com/"]
data = services.fetch_site(sites, concurrency=2)
self.assertTrue(len(data) == 1)
self.assertTrue(data[0]["status"] == 200)
self.assertTrue(data[0]["title"] == "Example Domain")
def test_fetch_data(self):
sites = ["https://mtp.myoas.com"]
data = services.fetch_site(sites, concurrency=2)
self.assertTrue(len(data) == 2)
self.assertTrue(data[1]["status"] == 200)
if __name__ == '__main__':
unittest.main()