Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_process_whois_details(self):
"""Test processing WHOIS details."""
payload = {'query': 'passivetotal.org'}
response = self.client.get_whois_details(**payload)
wrapped = Response(response)
for item in self.formats:
assert (getattr(wrapped, item))
def test_process_whois_search(self):
"""Test processing search results."""
payload = {'query': '18772064254', 'field': 'phone'}
response = self.client.search_whois_by_field(**payload)
results = Response(response)
assert (Response(results.results[0]).domain) == 'passivetotal.org'
def test_subdomains(self):
"""Test processing subdomains."""
payload = {'query': '*.passivetotal.org'}
response = self.client.get_subdomains(**payload)
wrapped = Response(response)
assert (wrapped.queryValue) == '*.passivetotal.org'
assert ('www' in wrapped.subdomains)
def test_process_dns_passive(self):
"""Test processing passive DNS records."""
payload = {'query': 'passivetotal.org'}
response = self.client.get_passive_dns(**payload)
wrapped = Response(response)
assert (wrapped.queryValue) == 'passivetotal.org'
assert (Response(wrapped.results.pop(0)).recordHash) == '6d24bc7754af023afeaaa05ac689ac36e96656aa6519ba435b301b14916b27d3'
def test_property_load(self):
"""Test loading properties on a result."""
payload = {'query': 'e9a6647d6aba52dc47b3838c920c9ee59bad7034'}
response = self.client.get_ssl_certificate_details(**payload)
wrapped = Response(response)
for key, value in iteritems(response):
assert (getattr(wrapped, key)) == value
def test_osint(self):
"""Test getting unique passive DNS records."""
payload = {'query': 'xxxvideotube.org'}
response = self.client.get_osint(**payload)
wrapped = Response(response)
assert (response['results'])
record = wrapped.results.pop(0)
record = Response(record)
assert (record.source) == 'RiskIQ'
assert (record.sourceUrl) == "https://www.riskiq.com/blog/riskiq-labs/post/a-brief-encounter-with-slempo"
def test_process_ssl_certificate_search(self):
"""Test processing search results."""
payload = {'query': 'www.passivetotal.org', 'field': 'subjectCommonName'}
response = self.client.search_ssl_certificate_by_field(**payload)
results = Response(response)
assert (Response(results.results[0]).serialNumber) == '2317683628587350290823564500811277499'
def test_process_whois_search(self):
"""Test processing search results."""
payload = {'query': '18772064254', 'field': 'phone'}
response = self.client.search_whois_by_field(**payload)
results = Response(response)
assert (Response(results.results[0]).domain) == 'passivetotal.org'
def setup_class(self):
self.patcher = patch('passivetotal.api.Client._get', fake_request)
self.patcher.start()
self.client = DnsRequest('--No-User--', '--No-Key--')
def test_dynamic_dns(self):
"""Test various actions for dynamic DNS."""
payload = {'query': 'passivetotal.org'}
response = self.client.get_dynamic_dns_status(**payload)
assert not (response['dynamicDns'])
payload = {'query': 'passivetotal.org', 'status': 'false'}
response = self.client.set_dynamic_dns_status(**payload)
assert not (response['dynamicDns'])
with pytest.raises(MISSING_FIELD) as excinfo:
def missing_field():
payload = {'query': 'passivetotal.org', 'no-status': 'false'}
self.client.set_dynamic_dns_status(**payload)
missing_field()
assert 'field is required' in str(excinfo.value)