From 0cec8466ca14fb1db0723b9ecb286c6a198685c8 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 15 Nov 2024 22:12:00 -0500 Subject: [PATCH] fix leakix tests --- bbot/modules/leakix.py | 7 +++++++ bbot/test/test_step_2/module_tests/test_module_leakix.py | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/bbot/modules/leakix.py b/bbot/modules/leakix.py index 0d697c4ff..ba098f800 100644 --- a/bbot/modules/leakix.py +++ b/bbot/modules/leakix.py @@ -17,6 +17,13 @@ class leakix(subdomain_enum_apikey): base_url = "https://leakix.net" ping_url = f"{base_url}/host/1.1.1.1" + async def setup(self): + ret = await super(subdomain_enum_apikey, self).setup() + self.api_key = self.config.get("api_key", "") + if self.api_key: + return await self.require_api_key() + return ret + def prepare_api_request(self, url, kwargs): if self.api_key: kwargs["headers"]["api-key"] = self.api_key diff --git a/bbot/test/test_step_2/module_tests/test_module_leakix.py b/bbot/test/test_step_2/module_tests/test_module_leakix.py index 0c7a0a529..13b922159 100644 --- a/bbot/test/test_step_2/module_tests/test_module_leakix.py +++ b/bbot/test/test_step_2/module_tests/test_module_leakix.py @@ -30,6 +30,10 @@ class TestLeakIX_NoAPIKey(ModuleTestBase): modules_overrides = ["leakix"] async def setup_before_prep(self, module_test): + module_test.httpx_mock.add_response( + url="https://leakix.net/host/1.1.1.1", + json={"title": "Not Found", "description": "Host not found"}, + ) module_test.httpx_mock.add_response( url=f"https://leakix.net/api/subdomains/blacklanternsecurity.com", json=[