Skip to content

Commit

Permalink
feat: test duplicated key in event
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhoheiser committed May 8, 2024
1 parent 96012b4 commit ace42fa
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 4 deletions.
12 changes: 10 additions & 2 deletions tests/aws/services/events/test_events_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
from tests.aws.services.events.helper_functions import is_v2_provider
from tests.aws.services.events.test_events import EVENT_DETAIL, TEST_EVENT_PATTERN

EVENT_DETAIL_DUPLICATED_KEY = {
"command": "update-account",
"payload": {"acc_id": "0a787ecb-4015", "payload": {"message": "baz", "id": "123"}},
}


class TestEventsInputPath:
@markers.aws.validated
Expand Down Expand Up @@ -37,12 +42,15 @@ def test_put_events_with_input_path(self, put_events_with_filter_to_sqs, snapsho
snapshot.match("message", messages)

@markers.aws.validated
def test_put_events_with_input_path_nested(self, put_events_with_filter_to_sqs, snapshot):
@pytest.mark.parametrize("event_detail", [EVENT_DETAIL, EVENT_DETAIL_DUPLICATED_KEY])
def test_put_events_with_input_path_nested(
self, event_detail, put_events_with_filter_to_sqs, snapshot
):
entries1 = [
{
"Source": TEST_EVENT_PATTERN["source"][0],
"DetailType": TEST_EVENT_PATTERN["detail-type"][0],
"Detail": json.dumps(EVENT_DETAIL),
"Detail": json.dumps(event_detail),
}
]
entries_asserts = [(entries1, True)]
Expand Down
37 changes: 36 additions & 1 deletion tests/aws/services/events/test_events_inputs.snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
}
},
"tests/aws/services/events/test_events_inputs.py::TestEventsInputPath::test_put_events_with_input_path": {
"recorded-date": "06-05-2024, 15:11:50",
"recorded-date": "08-05-2024, 13:54:10",
"recorded-content": {
"message": [
{
Expand Down Expand Up @@ -110,5 +110,40 @@
}
]
}
},
"tests/aws/services/events/test_events_inputs.py::TestEventsInputPath::test_put_events_with_input_path_nested[event_detail0]": {
"recorded-date": "08-05-2024, 13:54:42",
"recorded-content": {
"message": [
{
"MessageId": "<uuid:1>",
"ReceiptHandle": "<receipt-handle:1>",
"MD5OfBody": "<m-d5-of-body:1>",
"Body": {
"acc_id": "0a787ecb-4015",
"sf_id": "baz"
}
}
]
}
},
"tests/aws/services/events/test_events_inputs.py::TestEventsInputPath::test_put_events_with_input_path_nested[event_detail1]": {
"recorded-date": "08-05-2024, 13:54:44",
"recorded-content": {
"message": [
{
"MessageId": "<uuid:1>",
"ReceiptHandle": "<receipt-handle:1>",
"MD5OfBody": "<m-d5-of-body:1>",
"Body": {
"acc_id": "0a787ecb-4015",
"payload": {
"message": "baz",
"id": "123"
}
}
}
]
}
}
}
8 changes: 7 additions & 1 deletion tests/aws/services/events/test_events_inputs.validation.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"tests/aws/services/events/test_events_inputs.py::TestEventsInputPath::test_put_events_with_input_path": {
"last_validated_date": "2024-05-06T15:11:50+00:00"
"last_validated_date": "2024-05-08T13:54:10+00:00"
},
"tests/aws/services/events/test_events_inputs.py::TestEventsInputPath::test_put_events_with_input_path_max_level_depth": {
"last_validated_date": "2024-05-06T15:11:54+00:00"
Expand All @@ -11,6 +11,12 @@
"tests/aws/services/events/test_events_inputs.py::TestEventsInputPath::test_put_events_with_input_path_nested": {
"last_validated_date": "2024-05-06T15:11:52+00:00"
},
"tests/aws/services/events/test_events_inputs.py::TestEventsInputPath::test_put_events_with_input_path_nested[event_detail0]": {
"last_validated_date": "2024-05-08T13:54:42+00:00"
},
"tests/aws/services/events/test_events_inputs.py::TestEventsInputPath::test_put_events_with_input_path_nested[event_detail1]": {
"last_validated_date": "2024-05-08T13:54:44+00:00"
},
"tests/aws/services/events/test_events_inputs.py::TestEventsInputTransformers::test_put_events_with_input_transformation_to_sqs": {
"last_validated_date": "2024-03-26T15:48:35+00:00"
}
Expand Down

0 comments on commit ace42fa

Please sign in to comment.