-
-
Notifications
You must be signed in to change notification settings - Fork 669
Expand file tree
/
Copy pathtest_getweblinks.py
More file actions
27 lines (21 loc) · 997 Bytes
/
test_getweblinks.py
File metadata and controls
27 lines (21 loc) · 997 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
import sys
import os
import unittest
from io import StringIO
sys.path.append(os.path.abspath('../modules'))
import getweblinks
from bcolors import Bcolors
import pagereader
soup = pagereader.readPage('http://www.whatsmyip.net/')
class getLinksTestCase(unittest.TestCase):
def setUp(self):
self.held, sys.stdout = sys.stdout, StringIO()
self.maxDiff=None
def test_print_links(self):
#data = "\nWebsites Found - 7\n-------------------------------\nhttp://ads.wsrs.net/www/delivery/ck.php?n=MyIP856a6b4\nhttp://ads.wsrs.net/www/delivery/ck.php?n=MyIPbf5d683\nhttp://aff.ironsocket.com/SH7L\nhttp://aff.ironsocket.com/SH7L\nhttp://ads.wsrs.net/www/delivery/ck.php?n=MyIPdb5f512\nhttp://wsrs.net/\nhttp://cmsgear.com/\n"
data = "\n"+Bcolors.OKGREEN+"Websites Found - "+Bcolors.ENDC+"1\n-------------------------------\nhttp://cmsgear.com/\n"
ext = ['.com/']
getweblinks.getLinks(soup,ext)
self.assertEqual(sys.stdout.getvalue(),data)
if __name__ == '__main__':
unittest.main()