Skip to content

Commit d256717

Browse files
authored
Merge pull request #32 from y-mehta/dev
Test Case for save to file feature
2 parents 7a8ee6e + 7c84f39 commit d256717

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ install:
1212
script:
1313
- python3 test_getemails.py
1414
- python3 test_getweblinks.py
15+
- python3 test_savetofile.py
1516
notifications:
1617
slack: dedsec-inside:24NHg47gypeVR3DWnEncRq7c

tests/test_savetofile.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import sys
2+
import os
3+
import unittest
4+
from io import StringIO
5+
sys.path.append(os.path.abspath('../modules'))
6+
import getweblinks
7+
from bcolors import Bcolors
8+
import pagereader
9+
import time
10+
11+
soup = pagereader.readPage('http://www.whatsmyip.net/')
12+
timestr = time.strftime("%Y%m%d-%H%M%S")
13+
14+
class getLinksTestCase(unittest.TestCase):
15+
16+
def setUp(self):
17+
self.held, sys.stdout = sys.stdout, StringIO()
18+
self.maxDiff=None
19+
20+
def test_save_links(self):
21+
data = "\n"+Bcolors.OKGREEN+"Websites Found - "+Bcolors.ENDC+"1\n-------------------------------\nhttp://cmsgear.com/\n\nData will be saved with a File Name :"+ "TorBoT-Export-Onion-Links"+timestr+".json\n"
22+
ext = ['.com/']
23+
getweblinks.getLinks(soup,ext,0,1)
24+
self.assertEqual(sys.stdout.getvalue(),data)
25+
26+
27+
if __name__ == '__main__':
28+
unittest.main()
29+

0 commit comments

Comments
 (0)