Path: blob/master/tests/discovery/test_certspotter.py
609 views
#!/usr/bin/env python31# coding=utf-82import os3from typing import Optional45import pytest6import httpx7from _pytest.mark.structures import MarkDecorator89from theHarvester.discovery import certspottersearch10from theHarvester.lib.core import *1112pytestmark: MarkDecorator = pytest.mark.asyncio13github_ci: Optional[str] = os.getenv(14"GITHUB_ACTIONS"15) # Github set this to be the following: true instead of True161718class TestCertspotter(object):19@staticmethod20def domain() -> str:21return "metasploit.com"222324@pytest.mark.skipif(github_ci == 'true', reason="Skipping this test for now")25class TestCertspotterSearch(object):26async def test_api(self) -> None:27base_url = f"https://api.certspotter.com/v1/issuances?domain={TestCertspotter.domain()}&expand=dns_names"28headers = {"User-Agent": Core.get_user_agent()}29request = httpx.get(base_url, headers=headers)30assert request.status_code == 2003132async def test_search(self) -> None:33search = certspottersearch.SearchCertspoter(TestCertspotter.domain())34await search.process()35assert isinstance(await search.get_hostnames(), set)363738if __name__ == "__main__":39pytest.main()404142