From 8788febaf0696fcee0118a02631428edcc3a78ce Mon Sep 17 00:00:00 2001 From: ekneg54 Date: Fri, 8 Nov 2024 10:23:42 +0100 Subject: [PATCH] fix example and check it in a test --- logprep/processor/requester/rule.py | 3 +-- .../processor/requester/test_requester_rule.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/logprep/processor/requester/rule.py b/logprep/processor/requester/rule.py index c5b86fa3b..0ba2fb0ac 100644 --- a/logprep/processor/requester/rule.py +++ b/logprep/processor/requester/rule.py @@ -16,9 +16,8 @@ requester: url: https://internal.cmdb.local/api/v1/locations method: POST - content_type: application/json target_field: cmdb.location - header: + headers: Authorization: Bearer askdfjpiowejf283u9r json: hostname: ${message.hostname} diff --git a/tests/unit/processor/requester/test_requester_rule.py b/tests/unit/processor/requester/test_requester_rule.py index 1c7ebdbf3..e8973b126 100644 --- a/tests/unit/processor/requester/test_requester_rule.py +++ b/tests/unit/processor/requester/test_requester_rule.py @@ -1,6 +1,7 @@ # pylint: disable=protected-access # pylint: disable=missing-docstring import pytest + from logprep.processor.requester.rule import RequesterRule @@ -16,6 +17,21 @@ def test_create_from_dict_returns_requester_rule(self): @pytest.mark.parametrize( ["rule", "error", "message"], [ + ( + { + "filter": "domain", + "requester": { + "url": "https://internal.cmdb.local/api/v1/locations", + "method": "POST", + "target_field": "cmdb.location", + "headers": {"Authorization": "Bearer askdfjpiowejf283u9r"}, + "json": {"hostname": "${message.hostname}"}, + }, + "description": "...", + }, + None, + None, + ), ( { "filter": "message",