Merge pull request #2543 from stephenmuss/orgs-describe-create-account-status
Added describe_create_account_status to organizations
This commit is contained in:
commit
4a282578c0
4 changed files with 42 additions and 2 deletions
|
|
@ -269,10 +269,32 @@ class OrganizationsBackend(BaseBackend):
|
|||
)
|
||||
return account
|
||||
|
||||
def get_account_by_attr(self, attr, value):
|
||||
account = next(
|
||||
(
|
||||
account
|
||||
for account in self.accounts
|
||||
if hasattr(account, attr) and getattr(account, attr) == value
|
||||
),
|
||||
None,
|
||||
)
|
||||
if account is None:
|
||||
raise RESTError(
|
||||
"AccountNotFoundException",
|
||||
"You specified an account that doesn't exist.",
|
||||
)
|
||||
return account
|
||||
|
||||
def describe_account(self, **kwargs):
|
||||
account = self.get_account_by_id(kwargs["AccountId"])
|
||||
return account.describe()
|
||||
|
||||
def describe_create_account_status(self, **kwargs):
|
||||
account = self.get_account_by_attr(
|
||||
"create_account_status_id", kwargs["CreateAccountRequestId"]
|
||||
)
|
||||
return account.create_account_status
|
||||
|
||||
def list_accounts(self):
|
||||
return dict(
|
||||
Accounts=[account.describe()["Account"] for account in self.accounts]
|
||||
|
|
|
|||
|
|
@ -65,6 +65,13 @@ class OrganizationsResponse(BaseResponse):
|
|||
self.organizations_backend.describe_account(**self.request_params)
|
||||
)
|
||||
|
||||
def describe_create_account_status(self):
|
||||
return json.dumps(
|
||||
self.organizations_backend.describe_create_account_status(
|
||||
**self.request_params
|
||||
)
|
||||
)
|
||||
|
||||
def list_accounts(self):
|
||||
return json.dumps(self.organizations_backend.list_accounts())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue