Files
theHarvester/myparser_test.py
T
Peter McAlpine 7e131a0b1d Fix EXTRAword.com matching when word is 'word.com'
This change makes myparser.emails(...) stricter so that, given a word
(eg: 'word.com') it does not match domains which end with that word
(i.e. some-other-word.com). Subdomains continue to be matched (eg:
'subdomain.word.com').

Also add unit test for emails(...)
2015-03-05 14:04:50 -05:00

19 lines
429 B
Python

#
# Unit tests for myparser.py
#
import myparser
import unittest
class TestMyParser(unittest.TestCase):
def test_emails(self):
word = 'domain.com'
results = '***a@domain***banotherdomain.com***c@domain.com***d@sub.domain.com***'
p = myparser.parser(results, word)
emails = sorted(p.emails())
self.assertEquals(emails, [ 'c@domain.com', 'd@sub.domain.com' ])
if __name__ == '__main__':
unittest.main()