fix: Skip tests on haveibeenpwned.com if 403. Make pep8 happy.

pull/322/head
Raphaël Vinot 3 years ago
parent 40c70c1a53
commit 80ce0a58b5
  1. 4
      misp_modules/modules/expansion/virustotal.py
  2. 4
      tests/test_expansions.py

@ -40,7 +40,7 @@ class VirusTotalParser(object):
return {'results': results}
################################################################################
#### Main parsing functions ####
#### Main parsing functions #### # noqa
################################################################################
def parse_domain(self, domain, recurse=False):
@ -123,7 +123,7 @@ class VirusTotalParser(object):
return status_code
################################################################################
#### Additional parsing functions ####
#### Additional parsing functions #### # noqa
################################################################################
def parse_related_urls(self, query_result, recurse, uuid=None):

@ -20,6 +20,8 @@ class TestExpansions(unittest.TestCase):
def get_values(self, response):
data = response.json()
print(json.dumps(data, indent=2))
if not isinstance(data, dict):
return data
return data['results'][0]['values']
def test_cve(self):
@ -40,6 +42,8 @@ class TestExpansions(unittest.TestCase):
def test_haveibeenpwned(self):
query = {"module": "hibp", "email-src": "info@circl.lu"}
response = self.misp_modules_post(query)
if response == "haveibeenpwned.com API not accessible (HTTP 403)":
self.skipTest(f"haveibeenpwned blocks travis IPs: {response}")
self.assertEqual(self.get_values(response), 'OK (Not Found)', response)
def test_greynoise(self):

Loading…
Cancel
Save