forked from MISP/misp-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [tests] Fixed hibp test which requires an API key
- Loading branch information
Showing
1 changed file
with
8 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' | ||
|