Skip to content

Commit

Permalink
fix: [tests] Fixed hibp test which requires an API key
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisr3d committed Apr 14, 2021
1 parent 729feaa commit 6dda2d0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/test_expansions.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,16 @@ def test_farsight_passivedns(self):
self.assertEqual(self.get_errors(response), 'Farsight DNSDB apikey is missing')

def test_haveibeenpwned(self):
module_name = 'hibp'
query = {"module": "hibp", "email-src": "[email protected]"}
response = self.misp_modules_post(query)
to_check = self.get_values(response)
if to_check == "haveibeenpwned.com API not accessible (HTTP 401)":
self.skipTest(f"haveibeenpwned blocks travis IPs: {response}")
self.assertEqual(to_check, 'OK (Not Found)', response)
if module_name in self.configs:
to_check = self.get_values(response)
if to_check == "haveibeenpwned.com API not accessible (HTTP 401)":
self.skipTest(f"haveibeenpwned blocks travis IPs: {response}")
self.assertEqual(to_check, 'OK (Not Found)', response)
else:
self.assertEqual(self.get_errors(response), 'Have I Been Pwned authentication is incomplete (no API key)')

def test_greynoise(self):
module_name = 'greynoise'
Expand Down

0 comments on commit 6dda2d0

Please sign in to comment.