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