From ae710a83b0e8d3c5ec2e8ca9f1d139f61b050a5c Mon Sep 17 00:00:00 2001 From: dtrai2 Date: Mon, 23 Dec 2024 18:21:13 +0100 Subject: [PATCH] add example requester test case for merging response with existing dict - Introduced a new test case to validate merging response data with an existing dictionary. - Ensures proper behavior when "merge_with_target" is enabled in the requester configuration. --- .../processor/requester/test_requester.py | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/unit/processor/requester/test_requester.py b/tests/unit/processor/requester/test_requester.py index 04157ebbb..035f867d1 100644 --- a/tests/unit/processor/requester/test_requester.py +++ b/tests/unit/processor/requester/test_requester.py @@ -277,6 +277,28 @@ "status": 200, }, ), + ( + "merge response with existing dict", + { + "filter": "data", + "requester": { + "url": "http://localhost/", + "method": "GET", + "target_field": "data", + "delete_source_fields": True, + "merge_with_target": True, + }, + }, + {"data": {"existing": "data"}}, + {"data": {"existing": "data", "new-data": {"dict": "value"}}}, + { + "method": "GET", + "url": "http://localhost/", + "json": {"new-data": {"dict": "value"}}, + "content_type": "text/plain", + "status": 200, + }, + ), ] # testcase, rule, event, expected, response failure_test_cases = [