Added references to moto.iam.models.ACCOUNT_ID instead of hardcoded id

This commit is contained in:
Fabio Dias 2019-12-15 19:22:26 -05:00
commit b83a750630
54 changed files with 326 additions and 295 deletions

View file

@ -2,6 +2,7 @@ from __future__ import unicode_literals
import json
from werkzeug.exceptions import BadRequest
from moto.iam.models import ACCOUNT_ID
class ResourceNotFoundError(BadRequest):
@ -23,14 +24,14 @@ class ResourceInUseError(BadRequest):
class StreamNotFoundError(ResourceNotFoundError):
def __init__(self, stream_name):
super(StreamNotFoundError, self).__init__(
"Stream {0} under account 123456789012 not found.".format(stream_name)
"Stream {0} under account {1} not found.".format(stream_name, ACCOUNT_ID)
)
class ShardNotFoundError(ResourceNotFoundError):
def __init__(self, shard_id):
super(ShardNotFoundError, self).__init__(
"Shard {0} under account 123456789012 not found.".format(shard_id)
"Shard {0} under account {1} not found.".format(shard_id, ACCOUNT_ID)
)

View file

@ -13,6 +13,7 @@ from hashlib import md5
from moto.compat import OrderedDict
from moto.core import BaseBackend, BaseModel
from moto.core.utils import unix_time
from moto.iam.models import ACCOUNT_ID
from .exceptions import (
StreamNotFoundError,
ShardNotFoundError,
@ -133,7 +134,7 @@ class Stream(BaseModel):
self.shard_count = shard_count
self.creation_datetime = datetime.datetime.now()
self.region = region
self.account_number = "123456789012"
self.account_number = ACCOUNT_ID
self.shards = {}
self.tags = {}
self.status = "ACTIVE"
@ -259,8 +260,8 @@ class DeliveryStream(BaseModel):
@property
def arn(self):
return "arn:aws:firehose:us-east-1:123456789012:deliverystream/{0}".format(
self.name
return "arn:aws:firehose:us-east-1:{1}:deliverystream/{0}".format(
self.name, ACCOUNT_ID
)
def destinations_to_dict(self):