theHarvester/tests/discovery/test_linkedin_links.py

29 lines
736 B
Python
Raw Normal View History

#!/usr/bin/env python3
# coding=utf-8
from theHarvester.discovery import linkedinsearch
2019-09-07 11:00:22 +08:00
import pytest
2019-09-08 08:34:11 +08:00
import re
class TestGetLinks(object):
def test_get_links(self):
search = linkedinsearch.SearchLinkedin("facebook.com", '100')
search.process()
links = search.get_links()
2019-09-08 07:50:53 +08:00
assert list(links)
2019-09-07 11:35:59 +08:00
2019-09-08 08:34:11 +08:00
def test_links_linkedin(self):
f = open("test_linkedin_links.txt").read()
reg_links = re.compile(r"url=https:\/\/www\.linkedin.com(.*?)&")
temp = reg_links.findall(f)
resul = []
for x in temp:
y = x.replace("url=", "")
resul.append("https://www.linkedin.com" + y)
assert set(resul)
if __name__ == '__main__':
pytest.main()