Added describe_create_account_status to organizations
This commit is contained in:
parent
b19abbc63e
commit
a6255f9801
@ -4723,7 +4723,7 @@
|
|||||||
- [ ] update_server_engine_attributes
|
- [ ] update_server_engine_attributes
|
||||||
|
|
||||||
## organizations
|
## organizations
|
||||||
41% implemented
|
43% implemented
|
||||||
- [ ] accept_handshake
|
- [ ] accept_handshake
|
||||||
- [X] attach_policy
|
- [X] attach_policy
|
||||||
- [ ] cancel_handshake
|
- [ ] cancel_handshake
|
||||||
@ -4737,7 +4737,7 @@
|
|||||||
- [ ] delete_organizational_unit
|
- [ ] delete_organizational_unit
|
||||||
- [ ] delete_policy
|
- [ ] delete_policy
|
||||||
- [X] describe_account
|
- [X] describe_account
|
||||||
- [ ] describe_create_account_status
|
- [X] describe_create_account_status
|
||||||
- [ ] describe_handshake
|
- [ ] describe_handshake
|
||||||
- [X] describe_organization
|
- [X] describe_organization
|
||||||
- [X] describe_organizational_unit
|
- [X] describe_organizational_unit
|
||||||
|
@ -269,10 +269,32 @@ class OrganizationsBackend(BaseBackend):
|
|||||||
)
|
)
|
||||||
return account
|
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):
|
def describe_account(self, **kwargs):
|
||||||
account = self.get_account_by_id(kwargs["AccountId"])
|
account = self.get_account_by_id(kwargs["AccountId"])
|
||||||
return account.describe()
|
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):
|
def list_accounts(self):
|
||||||
return dict(
|
return dict(
|
||||||
Accounts=[account.describe()["Account"] for account in self.accounts]
|
Accounts=[account.describe()["Account"] for account in self.accounts]
|
||||||
|
@ -65,6 +65,13 @@ class OrganizationsResponse(BaseResponse):
|
|||||||
self.organizations_backend.describe_account(**self.request_params)
|
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):
|
def list_accounts(self):
|
||||||
return json.dumps(self.organizations_backend.list_accounts())
|
return json.dumps(self.organizations_backend.list_accounts())
|
||||||
|
|
||||||
|
@ -159,6 +159,17 @@ def test_create_account():
|
|||||||
create_status["AccountName"].should.equal(mockname)
|
create_status["AccountName"].should.equal(mockname)
|
||||||
|
|
||||||
|
|
||||||
|
@mock_organizations
|
||||||
|
def test_describe_create_account_status():
|
||||||
|
client = boto3.client("organizations", region_name="us-east-1")
|
||||||
|
client.create_organization(FeatureSet="ALL")["Organization"]
|
||||||
|
request_id = client.create_account(AccountName=mockname, Email=mockemail)[
|
||||||
|
"CreateAccountStatus"
|
||||||
|
]["Id"]
|
||||||
|
response = client.describe_create_account_status(CreateAccountRequestId=request_id)
|
||||||
|
validate_create_account_status(response["CreateAccountStatus"])
|
||||||
|
|
||||||
|
|
||||||
@mock_organizations
|
@mock_organizations
|
||||||
def test_describe_account():
|
def test_describe_account():
|
||||||
client = boto3.client("organizations", region_name="us-east-1")
|
client = boto3.client("organizations", region_name="us-east-1")
|
||||||
|
Loading…
Reference in New Issue
Block a user