Skip to content

Commit

Permalink
simplify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Anko59 committed Dec 3, 2024
1 parent 44d3b79 commit 514fd55
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions tests/test_cortex_endpoint.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
from thehive4py.client import TheHiveApi

from thehive4py.types.case import OutputCase

class TestCortexEndpoint:
def test_list_analyzers(self, thehive: TheHiveApi):
analyzers = thehive.cortex.list_analyzers()
assert isinstance(analyzers, list)
for analyzer in analyzers:
assert "name" in analyzer.keys()
assert "id" in analyzer.keys()
assert analyzers == []

def test_list_analyzers_by_type(self, thehive: TheHiveApi):
data_type = "mail"
analyzers = thehive.cortex.list_analyzers_by_type(data_type=data_type)
assert isinstance(analyzers, list)
for analyzer in analyzers:
assert "name" in analyzer.keys()
assert "id" in analyzer.keys()

def test_list_and_get_analyzers(self, thehive: TheHiveApi):
analyzers = thehive.cortex.list_analyzers()
for analyzer in analyzers:
_analyzer = thehive.cortex.get_analyzer(analyzer["id"])
assert _analyzer == analyzer
assert analyzers == []

def test_list_responders(self, thehive: TheHiveApi):
thehive.case.create(case={"title": "my first case", "description": "..."})
entity_type = "case"
entity_id = thehive.case.find()[0]["_id"]
def test_list_responders(self, thehive: TheHiveApi, test_case: OutputCase):
responders = thehive.cortex.list_responders(
entity_type=entity_type, entity_id=entity_id
entity_type="case", entity_id=test_case["_id"]
)
assert isinstance(responders, list)
for responder in responders:
assert "name" in responder.keys()
assert "id" in responder.keys()

0 comments on commit 514fd55

Please sign in to comment.