From e66046919a02e3cef1bc1b6eadd010265e85cc8c Mon Sep 17 00:00:00 2001 From: c8y3 <25362953+c8y3@users.noreply.github.com> Date: Fri, 27 Sep 2024 10:26:49 +0200 Subject: [PATCH] [FIX] Put back **kwargs as they seem necessary? --- source/app/blueprints/graphql/cases.py | 8 ++++--- tests/tests_graphql.py | 32 -------------------------- 2 files changed, 5 insertions(+), 35 deletions(-) diff --git a/source/app/blueprints/graphql/cases.py b/source/app/blueprints/graphql/cases.py index d775c862c..997b0c144 100644 --- a/source/app/blueprints/graphql/cases.py +++ b/source/app/blueprints/graphql/cases.py @@ -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, @@ -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 diff --git a/tests/tests_graphql.py b/tests/tests_graphql.py index c5accfe42..ee1809142 100644 --- a/tests/tests_graphql.py +++ b/tests/tests_graphql.py @@ -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()