diff --git a/source/app/blueprints/rest/v2/case/api_v2_ioc_routes.py b/source/app/blueprints/rest/v2/case/api_v2_ioc_routes.py index 9b62ac9ed..f8b8cb2ab 100644 --- a/source/app/blueprints/rest/v2/case/api_v2_ioc_routes.py +++ b/source/app/blueprints/rest/v2/case/api_v2_ioc_routes.py @@ -36,7 +36,6 @@ from app.models.authorization import CaseAccessLevel from app.schema.marshables import IocSchemaForAPIV2 from app.blueprints.access_controls import ac_api_return_access_denied -from app.blueprints.responses import response_success from app.blueprints.responses import response_error api_v2_ioc_blueprint = Blueprint('case_ioc_rest_v2', @@ -153,7 +152,7 @@ def update_ioc(identifier): try: ioc, msg = iocs_update(identifier, request.get_json()) - return response_success(msg, data=ioc_schema.dump(ioc)) + return response_api_success(ioc_schema.dump(ioc)) except BusinessProcessingError as e: return response_error(e.get_message(), data=e.get_data()) diff --git a/tests/tests_rest_iocs.py b/tests/tests_rest_iocs.py index ad4f8dedd..2885b0fff 100644 --- a/tests/tests_rest_iocs.py +++ b/tests/tests_rest_iocs.py @@ -164,3 +164,12 @@ def test_update_ioc_should_not_fail(self): ioc_identifier = response['ioc_id'] response = self._subject.update(f'/api/v2/iocs/{ioc_identifier}', {'ioc_value': '9.9.9.9'}) self.assertEqual(200, response.status_code) + + def test_update_ioc_should_return_updated_value(self): + case_identifier = self._subject.create_dummy_case() + body = {'ioc_type_id': 1, 'ioc_tlp_id': 2, 'ioc_value': '8.8.8.8', 'ioc_description': 'rewrw', 'ioc_tags': ''} + response = self._subject.create(f'/api/v2/cases/{case_identifier}/iocs', body).json() + ioc_identifier = response['ioc_id'] + new_value = '9.9.9.9' + response = self._subject.update(f'/api/v2/iocs/{ioc_identifier}', {'ioc_value': new_value}).json() + self.assertEqual(new_value, response['ioc_value'])