organizations: clean up for flake8
This commit is contained in:
parent
f20898da0e
commit
c40d2be646
6 changed files with 26 additions and 55 deletions
|
|
@ -1,7 +1,6 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import datetime
|
||||
import time
|
||||
|
||||
from moto.core import BaseBackend, BaseModel
|
||||
from moto.core.utils import unix_time
|
||||
|
|
@ -25,7 +24,7 @@ class FakeOrganization(BaseModel):
|
|||
'Type': 'SERVICE_CONTROL_POLICY',
|
||||
'Status': 'ENABLED'
|
||||
}]
|
||||
|
||||
|
||||
@property
|
||||
def arn(self):
|
||||
return ORGANIZATION_ARN_FORMAT.format(self.master_account_id, self.id)
|
||||
|
|
@ -115,7 +114,7 @@ class OrganizationsBackend(BaseBackend):
|
|||
return new_account.create_account_status
|
||||
|
||||
def describe_account(self, **kwargs):
|
||||
account = [account for account in self.accounts
|
||||
account = [account for account in self.accounts
|
||||
if account.account_id == kwargs['AccountId']][0]
|
||||
return account.describe()
|
||||
|
||||
|
|
@ -126,6 +125,3 @@ class OrganizationsBackend(BaseBackend):
|
|||
|
||||
|
||||
organizations_backend = OrganizationsBackend()
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,4 +45,3 @@ class OrganizationsResponse(BaseResponse):
|
|||
return json.dumps(
|
||||
self.organizations_backend.list_accounts()
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
|||
import random
|
||||
import string
|
||||
|
||||
CHARSET=string.ascii_lowercase + string.digits
|
||||
CHARSET = string.ascii_lowercase + string.digits
|
||||
ORG_ID_SIZE = 10
|
||||
ROOT_ID_SIZE = 4
|
||||
ACCOUNT_ID_SIZE = 12
|
||||
|
|
@ -11,24 +11,27 @@ CREATE_ACCOUNT_STATUS_ID_SIZE = 8
|
|||
|
||||
|
||||
def make_random_org_id():
|
||||
# The regex pattern for an organization ID string requires "o-"
|
||||
# The regex pattern for an organization ID string requires "o-"
|
||||
# followed by from 10 to 32 lower-case letters or digits.
|
||||
# e.g. 'o-vipjnq5z86'
|
||||
return 'o-' + ''.join(random.choice(CHARSET) for x in range(ORG_ID_SIZE))
|
||||
|
||||
|
||||
def make_random_root_id():
|
||||
# The regex pattern for a root ID string requires "r-" followed by
|
||||
# The regex pattern for a root ID string requires "r-" followed by
|
||||
# from 4 to 32 lower-case letters or digits.
|
||||
# e.g. 'r-3zwx'
|
||||
return 'r-' + ''.join(random.choice(CHARSET) for x in range(ROOT_ID_SIZE))
|
||||
|
||||
|
||||
def make_random_account_id():
|
||||
# The regex pattern for an account ID string requires exactly 12 digits.
|
||||
# e.g. '488633172133'
|
||||
return ''.join([random.choice(string.digits) for n in range(ACCOUNT_ID_SIZE)])
|
||||
|
||||
|
||||
def make_random_create_account_status_id():
|
||||
# The regex pattern for an create account request ID string requires
|
||||
# The regex pattern for an create account request ID string requires
|
||||
# "car-" followed by from 8 to 32 lower-case letters or digits.
|
||||
# e.g. 'car-35gxzwrp'
|
||||
return 'car-' + ''.join(random.choice(CHARSET) for x in range(CREATE_ACCOUNT_STATUS_ID_SIZE))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue