2
2
import pytest
3
3
from unittest .mock import patch
4
4
5
- from lib .helpers .wordlist_helper import WordList
6
- from lib .helpers .wordlist_helper import DEFAULT_WORDLIST_FILE
5
+ from VHostScan . lib .helpers .wordlist_helper import WordList
6
+ from VHostScan . lib .helpers .wordlist_helper import DEFAULT_WORDLIST_FILE
7
7
8
8
9
9
@pytest .fixture (scope = 'class' )
@@ -28,7 +28,7 @@ def test_get_wordlist_from_stdin(self):
28
28
stdin_wordlist = ['keyword1' , 'keyword1' ]
29
29
expected_wordlist = []
30
30
expected_wordlist .extend (stdin_wordlist )
31
- with patch ('lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
31
+ with patch ('VHostScan. lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
32
32
wordlist , wordlist_types = self .wordlist .get_wordlist ()
33
33
self .assertEqual (wordlist , expected_wordlist )
34
34
@@ -37,59 +37,59 @@ def test_get_wordlist_from_stdin_and_wordlist(self):
37
37
expected_wordlist = []
38
38
expected_wordlist .extend (stdin_wordlist )
39
39
expected_wordlist .extend (self .user_wordlist )
40
- with patch ('lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
40
+ with patch ('VHostScan. lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
41
41
wordlist , wordlist_types = self .wordlist .get_wordlist (self .user_wordlist_file )
42
42
self .assertEqual (wordlist , expected_wordlist )
43
43
44
44
def test_using_default_wordlist (self ):
45
45
stdin_wordlist = []
46
- with patch ('lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
46
+ with patch ('VHostScan. lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
47
47
wordlist , wordlist_types = self .wordlist .get_wordlist ()
48
48
self .assertEqual (wordlist , self .default_wordlist )
49
49
50
50
def test_ip_using_prefix (self ):
51
51
stdin_wordlist = ['127.0.0.1' ]
52
52
prefix = 'dev-'
53
- with patch ('lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
53
+ with patch ('VHostScan. lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
54
54
wordlist , wordlist_types = self .wordlist .get_wordlist (None , prefix )
55
55
self .assertEqual (wordlist , stdin_wordlist )
56
56
57
57
def test_ip_using_suffix (self ):
58
58
stdin_wordlist = ['127.0.0.1' ]
59
59
suffix = 'test'
60
- with patch ('lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
60
+ with patch ('VHostScan. lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
61
61
wordlist , wordlist_types = self .wordlist .get_wordlist (None ,None ,suffix )
62
62
self .assertEqual (wordlist ,stdin_wordlist )
63
63
64
64
def test_word_with_prefix (self ):
65
65
stdin_wordlist = ['www' ,'www2' ,'www3' ]
66
66
expected_wordlist = stdin_wordlist + ['dev-www' ,'dev-www2' ,'dev-www3' ]
67
67
prefix = 'dev-'
68
- with patch ('lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
68
+ with patch ('VHostScan. lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
69
69
wordlist , wordlist_types = self .wordlist .get_wordlist (None ,prefix )
70
70
self .assertEqual (wordlist ,expected_wordlist )
71
71
72
72
def test_words_with_suffix (self ):
73
73
stdin_wordlist = ['www' ,'www2' ,'www3' ]
74
74
expected_wordlist = stdin_wordlist + ['wwwtest' ,'www2test' ,'www3test' ]
75
75
suffix = 'test'
76
- with patch ('lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
76
+ with patch ('VHostScan. lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
77
77
wordlist , wordlist_types = self .wordlist .get_wordlist (None ,None ,suffix )
78
78
self .assertEqual (wordlist , expected_wordlist )
79
79
80
80
def test_words_with_host_and_prefix (self ):
81
81
stdin_wordlist = ['www.%s' ]
82
82
expected_wordlist = stdin_wordlist + ['test-www.%s' ]
83
83
prefix = 'test-'
84
- with patch ('lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
84
+ with patch ('VHostScan. lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
85
85
wordlist , wordlist_types = self .wordlist .get_wordlist (None , prefix )
86
86
self .assertEqual (wordlist , expected_wordlist )
87
87
88
88
def test_words_with_host_and_suffix (self ):
89
89
stdin_wordlist = ['www.%s' ]
90
90
expected_wordlist = stdin_wordlist + ['wwwtest.%s' ]
91
91
suffix = 'test'
92
- with patch ('lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
92
+ with patch ('VHostScan. lib.helpers.wordlist_helper.WordList.get_stdin_wordlist' , return_value = stdin_wordlist ):
93
93
wordlist , wordlist_types = self .wordlist .get_wordlist (None ,None ,suffix )
94
94
self .assertEqual (wordlist , expected_wordlist )
95
95
0 commit comments