Skip to content

Commit

Permalink
mock
Browse files Browse the repository at this point in the history
  • Loading branch information
g4ze committed May 24, 2024
1 parent 30baed0 commit 3d60b48
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions api_app/analyzers_manager/observable_analyzers/knockanalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from knock.knockpy import KNOCKPY

from api_app.analyzers_manager import classes
from tests.mock_utils import MockUpResponse, if_mock_connections, patch

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -37,3 +38,29 @@ def run(self):
)

return json.dumps(results)

@classmethod
def _monkeypatch(cls):
response = {
{
"marcia.domain.com": ["66.96.162.92"],
"http": [404, None, "Apache"],
"https": [None, None, None],
"cert": [None, None],
},
{
"mbsizer.domain.com": ["66.96.162.92"],
"http": [404, None, "Apache"],
"https": [None, None, None],
"cert": [None, None],
},
}
patches = [
if_mock_connections(
patch(
"knock.knockpy.KNOCKPY",
return_value=MockUpResponse(response, 200),
),
)
]
return super()._monkeypatch(patches=patches)

0 comments on commit 3d60b48

Please sign in to comment.