diff --git a/moto/events/models.py b/moto/events/models.py index 7d9b4d177..9f3cdec6a 100644 --- a/moto/events/models.py +++ b/moto/events/models.py @@ -287,6 +287,8 @@ class Archive(CloudFormationModel): if event_value not in pattern_value: return False + return True + def get_cfn_attribute(self, attribute_name): from moto.cloudformation.exceptions import UnformattedGetAttTemplateException diff --git a/tests/test_events/test_events.py b/tests/test_events/test_events.py index 8907fc752..cffd41228 100644 --- a/tests/test_events/test_events.py +++ b/tests/test_events/test_events.py @@ -1241,7 +1241,8 @@ def test_archive_actual_events(): # given client = boto3.client("events", "eu-central-1") name = "test-archive" - name_2 = "test-archive-2" + name_2 = "test-archive-no-match" + name_3 = "test-archive-matches" event_bus_arn = "arn:aws:events:eu-central-1:{}:event-bus/default".format( ACCOUNT_ID ) @@ -1256,6 +1257,11 @@ def test_archive_actual_events(): EventSourceArn=event_bus_arn, EventPattern=json.dumps({"DetailType": ["type"], "Source": ["test"]}), ) + client.create_archive( + ArchiveName=name_3, + EventSourceArn=event_bus_arn, + EventPattern=json.dumps({"DetailType": ["type"], "Source": ["source"]}), + ) # when response = client.put_events(Entries=[event]) @@ -1271,3 +1277,7 @@ def test_archive_actual_events(): response = client.describe_archive(ArchiveName=name_2) response["EventCount"].should.equal(0) response["SizeBytes"].should.equal(0) + + response = client.describe_archive(ArchiveName=name_3) + response["EventCount"].should.equal(1) + response["SizeBytes"].should.be.greater_than(0)