add ip rep

This commit is contained in:
larssand
2026-06-18 23:03:21 +02:00
parent f7611ef2b3
commit 6530e51700
3 changed files with 86 additions and 5 deletions

View File

@@ -33,6 +33,22 @@ class RecommendationTests(unittest.TestCase):
self.assertEqual(result["status"], "disabled")
def test_abuseipdb_is_preferred_when_key_exists(self):
with patch.dict(os.environ, {"FGAI_THREAT_INTEL": "1", "ABUSEIPDB_API_KEY": "test"}, clear=True):
client = ThreatIntelClient(cache_file="/tmp/fgai-test-threat-cache.json")
self.assertEqual(client._select_provider(), "abuseipdb")
def test_virustotal_can_be_forced(self):
with patch.dict(
os.environ,
{"FGAI_THREAT_INTEL": "1", "ABUSEIPDB_API_KEY": "test", "VIRUSTOTAL_API_KEY": "test", "FGAI_THREAT_INTEL_PROVIDER": "virustotal"},
clear=True,
):
client = ThreatIntelClient(cache_file="/tmp/fgai-test-threat-cache.json")
self.assertEqual(client._select_provider(), "virustotal")
if __name__ == "__main__":
unittest.main()