Modify Rule.send_to_targets() to handle event_bus_name as ARN (#3804)
* Modify Rule.send_to_targets() to handle event_bus_name as ARN * Apply black formatting Co-authored-by: Tom Noble <tom.noble@bjss.com>
This commit is contained in:
parent
9f9716ee01
commit
f549f1d087
@ -82,6 +82,7 @@ class Rule(CloudFormationModel):
|
|||||||
self.targets.pop(index)
|
self.targets.pop(index)
|
||||||
|
|
||||||
def send_to_targets(self, event_bus_name, event):
|
def send_to_targets(self, event_bus_name, event):
|
||||||
|
event_bus_name = event_bus_name.split("/")[-1]
|
||||||
if event_bus_name != self.event_bus_name:
|
if event_bus_name != self.event_bus_name:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -1318,6 +1318,34 @@ def test_archive_actual_events():
|
|||||||
response["SizeBytes"].should.be.greater_than(0)
|
response["SizeBytes"].should.be.greater_than(0)
|
||||||
|
|
||||||
|
|
||||||
|
@mock_events
|
||||||
|
def test_archive_event_with_bus_arn():
|
||||||
|
# given
|
||||||
|
client = boto3.client("events", "eu-central-1")
|
||||||
|
event_bus_arn = "arn:aws:events:eu-central-1:{}:event-bus/default".format(
|
||||||
|
ACCOUNT_ID
|
||||||
|
)
|
||||||
|
archive_name = "mock_archive"
|
||||||
|
event_with_bus_arn = {
|
||||||
|
"Source": "source",
|
||||||
|
"DetailType": "type",
|
||||||
|
"Detail": '{ "key1": "value1" }',
|
||||||
|
"EventBusName": event_bus_arn,
|
||||||
|
}
|
||||||
|
client.create_archive(ArchiveName=archive_name, EventSourceArn=event_bus_arn)
|
||||||
|
|
||||||
|
# when
|
||||||
|
response = client.put_events(Entries=[event_with_bus_arn])
|
||||||
|
|
||||||
|
# then
|
||||||
|
response["FailedEntryCount"].should.equal(0)
|
||||||
|
response["Entries"].should.have.length_of(1)
|
||||||
|
|
||||||
|
response = client.describe_archive(ArchiveName=archive_name)
|
||||||
|
response["EventCount"].should.equal(1)
|
||||||
|
response["SizeBytes"].should.be.greater_than(0)
|
||||||
|
|
||||||
|
|
||||||
@mock_events
|
@mock_events
|
||||||
def test_start_replay():
|
def test_start_replay():
|
||||||
# given
|
# given
|
||||||
|
Loading…
x
Reference in New Issue
Block a user