mirror of https://github.com/MISP/misp-modules
fix: Skip tests on haveibeenpwned.com if 403. Make pep8 happy.
parent
40c70c1a53
commit
80ce0a58b5
|
@ -40,7 +40,7 @@ class VirusTotalParser(object):
|
||||||
return {'results': results}
|
return {'results': results}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Main parsing functions ####
|
#### Main parsing functions #### # noqa
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
def parse_domain(self, domain, recurse=False):
|
def parse_domain(self, domain, recurse=False):
|
||||||
|
@ -123,7 +123,7 @@ class VirusTotalParser(object):
|
||||||
return status_code
|
return status_code
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#### Additional parsing functions ####
|
#### Additional parsing functions #### # noqa
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
def parse_related_urls(self, query_result, recurse, uuid=None):
|
def parse_related_urls(self, query_result, recurse, uuid=None):
|
||||||
|
|
|
@ -20,6 +20,8 @@ class TestExpansions(unittest.TestCase):
|
||||||
def get_values(self, response):
|
def get_values(self, response):
|
||||||
data = response.json()
|
data = response.json()
|
||||||
print(json.dumps(data, indent=2))
|
print(json.dumps(data, indent=2))
|
||||||
|
if not isinstance(data, dict):
|
||||||
|
return data
|
||||||
return data['results'][0]['values']
|
return data['results'][0]['values']
|
||||||
|
|
||||||
def test_cve(self):
|
def test_cve(self):
|
||||||
|
@ -40,6 +42,8 @@ class TestExpansions(unittest.TestCase):
|
||||||
def test_haveibeenpwned(self):
|
def test_haveibeenpwned(self):
|
||||||
query = {"module": "hibp", "email-src": "info@circl.lu"}
|
query = {"module": "hibp", "email-src": "info@circl.lu"}
|
||||||
response = self.misp_modules_post(query)
|
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)
|
self.assertEqual(self.get_values(response), 'OK (Not Found)', response)
|
||||||
|
|
||||||
def test_greynoise(self):
|
def test_greynoise(self):
|
||||||
|
|
Loading…
Reference in New Issue