Skip to content

Commit

Permalink
[FIX] Put back **kwargs as they seem necessary?
Browse files Browse the repository at this point in the history
  • Loading branch information
c8y3 committed Sep 27, 2024
1 parent 818e1b4 commit e660469
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 35 deletions.
8 changes: 5 additions & 3 deletions source/app/blueprints/graphql/cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ class Meta:

iocs = SQLAlchemyConnectionField(IOCConnection, ioc_id=Int(), ioc_uuid=String(), ioc_value=String(), ioc_type_id=Int(),
ioc_description=String(), ioc_tlp_id=Int(), ioc_tags=String(), ioc_misp=String(),
user_id=Float(), Linked_cases=Float())
user_id=Float())

# TODO why is kwargs necessary? Should investigate and try to remove
@staticmethod
def resolve_iocs(root, info, ioc_id=None, ioc_uuid=None, ioc_value=None, ioc_type_id=None, ioc_description=None, ioc_tlp_id=None, ioc_tags=None,
ioc_misp=None, user_id=None):
ioc_misp=None, user_id=None, **kwargs):
return iocs_build_filter_query(ioc_id=ioc_id, ioc_uuid=ioc_uuid, ioc_value=ioc_value,
ioc_type_id=ioc_type_id, ioc_description=ioc_description,
ioc_tlp_id=ioc_tlp_id, ioc_tags=ioc_tags, ioc_misp=ioc_misp,
Expand All @@ -65,8 +66,9 @@ class Meta:

total_count = Int()

# TODO why is kwargs necessary? Should investigate and try to remove
@staticmethod
def resolve_total_count(root, info):
def resolve_total_count(root, info, **kwargs):
return root.length


Expand Down
32 changes: 0 additions & 32 deletions tests/tests_graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,38 +349,6 @@ def test_graphql_iocs_should_return_all_iocs_of_a_case(self):
response = self._subject.execute_graphql_query(payload)
self.assertNotIn('errors', response)

def test_graphql_iocs_should_return_linked_iocs_of_a_case(self):
case_identifier = 1
case_identifier_2 = 2
ioc_value = self._generate_new_dummy_ioc_value()
payload = {'query': ' mutation { caseCreate(name: "case2", description: "Some description", clientId: 1) { case { description } } }'}
self._subject.execute_graphql_query(payload)
payload = {
'query': f'''mutation {{
iocCreate(caseId: {case_identifier}, typeId: 1, tlpId: 1, value: "{ioc_value}") {{
ioc {{ iocId }}
}}
}}'''
}
self._subject.execute_graphql_query(payload)
payload = {
'query': f'''mutation {{
iocCreate(caseId: {case_identifier_2}, typeId: 1, tlpId: 1, value: "{ioc_value}") {{
ioc {{ iocId }}
}}
}}'''
}
self._subject.execute_graphql_query(payload)
payload = {
'query': f'''{{
case(caseId: {case_identifier}) {{
iocs(LinkedCases: 1) {{ edges {{ node {{ iocId }} }} }}
}}
}}'''
}
response = self._subject.execute_graphql_query(payload)
self.assertNotIn('errors', response)

def test_graphql_case_should_return_error_log_uuid_when_permission_denied(self):
user = self._subject.create_user(self._generate_new_dummy_user_name())
case_identifier = self._create_case()
Expand Down

0 comments on commit e660469

Please sign in to comment.