From 2424d6368636d6efc50ef07da01ca970ff91108d Mon Sep 17 00:00:00 2001 From: Jessie Nadler Date: Thu, 3 Oct 2019 15:29:54 -0400 Subject: [PATCH] Use self.region_name to generate rule ARN --- moto/events/models.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/moto/events/models.py b/moto/events/models.py index 6e4a75d07..7871bae7b 100644 --- a/moto/events/models.py +++ b/moto/events/models.py @@ -9,15 +9,16 @@ from moto.core import BaseBackend, BaseModel class Rule(BaseModel): - def _generate_arn(self, name, region_name): + def _generate_arn(self, name): return 'arn:aws:events:{region_name}:111111111111:rule/{name}'.format( - region_name=region_name, + region_name=self.region_name, name=name ) def __init__(self, name, region_name, **kwargs): self.name = name - self.arn = kwargs.get('Arn') or self._generate_arn(name, region_name) + self.region_name = region_name + self.arn = kwargs.get('Arn') or self._generate_arn(name) self.event_pattern = kwargs.get('EventPattern') self.schedule_exp = kwargs.get('ScheduleExpression') self.state = kwargs.get('State') or 'ENABLED'