theHarvester/tests/discovery/test_qwantsearch.py
J.Townsend 22e1eb9bdb
A lot of changes and fixes (#1168)
* add pytest.ini file and fix test warning in qwantsearch

* ignore unsed imports

* Remove n45ht as the api is down

* Remove modules that use google as google blocks you after one go

* Remove missed code from when removing modules that use google

* Remove missed code from when removing modules that use google

* Add new vt-py dep and update pytest

* WIP virustotal migration to api

* Remove test that fails due to how the api returns not found entries

* Remove entries from myparser re google

* update fastapi and starlette

* update version

* Update dockerfile to use dev ubuntu version

* remove spyse module

* remove spyse dep

* fix tests by removing un-needed tests and indentation fix

* fix some mypy errors

* remove spyse and remove color output and fix mypy error

* flake8 fixes

* bump version and set it a dev version
2022-08-03 23:12:59 +01:00

37 lines
1.3 KiB
Python

#!/usr/bin/env python3
# coding=utf-8
from theHarvester.discovery import qwantsearch
import os
import pytest
pytestmark = pytest.mark.asyncio
github_ci = os.getenv('GITHUB_ACTIONS') # Github set this to be the following: true instead of True
class TestSearchQwant(object):
@staticmethod
def domain() -> str:
return 'example.com'
async def test_get_start_offset_return_0(self):
search = qwantsearch.SearchQwant(TestSearchQwant.domain(), 0, 200)
assert search.get_start_offset() == 0
async def test_get_start_offset_return_50(self):
search = qwantsearch.SearchQwant(TestSearchQwant.domain(), 55, 200)
assert search.get_start_offset() == 50
async def test_get_start_offset_return_100(self):
search = qwantsearch.SearchQwant(TestSearchQwant.domain(), 100, 200)
assert search.get_start_offset() == 100
async def test_get_emails(self):
search = qwantsearch.SearchQwant(TestSearchQwant.domain(), 0, 200)
await search.process()
assert isinstance(await search.get_emails(), set)
async def test_get_hostnames(self):
search = qwantsearch.SearchQwant(TestSearchQwant.domain(), 0, 200)
await search.process()
assert isinstance(await search.get_hostnames(), list)