-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_crawler.py
More file actions
32 lines (25 loc) · 949 Bytes
/
test_crawler.py
File metadata and controls
32 lines (25 loc) · 949 Bytes
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
import unittest
from webscanner import WebScanner
class test_crawler(unittest.TestCase):
def test_clean_url(self):
crawler = WebScanner("https://google.com/")
newurl = crawler.clean_url("https://google.com/#everythingHereShouldBe#Removed")
assert newurl == "https://google.com/"
newurl = crawler.clean_url(
"https://google.com/?a=everythingHereShouldBe#Removed"
)
assert newurl == "https://google.com/"
def test_is_external(self):
crawler = WebScanner("https://google.com/")
assert crawler.is_external("https://external.com/")
assert not crawler.is_external("https://google.com/bla")
def test_end_to_end(self):
crawler = WebScanner(
"https://emerald-it.nl/",
max_depth=1,
test_external_urls=False,
verbose=0,
)
crawler.crawl()
if __name__ == "__main__":
unittest.main()