2019-01-06 17:50:07 +08:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# coding=utf-8
|
|
|
|
|
2019-03-24 15:53:59 +08:00
|
|
|
from theHarvester.parsers import myparser
|
2019-01-06 17:50:07 +08:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
class TestMyParser(object):
|
|
|
|
|
2020-01-04 15:24:09 +08:00
|
|
|
@pytest.mark.asyncio
|
|
|
|
async def test_emails(self):
|
2019-01-06 17:50:07 +08:00
|
|
|
word = 'domain.com'
|
|
|
|
results = '@domain.com***a@domain***banotherdomain.com***c@domain.com***d@sub.domain.com***'
|
|
|
|
parse = myparser.Parser(results, word)
|
2020-01-04 15:24:09 +08:00
|
|
|
emails = sorted(await parse.emails())
|
2019-01-06 17:50:07 +08:00
|
|
|
assert emails, ['c@domain.com', 'd@sub.domain.com']
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2019-08-20 05:50:32 +08:00
|
|
|
pytest.main()
|