Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
viren-nadkarni committed Dec 11, 2024
1 parent ceffbf2 commit 5601d8f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
7 changes: 5 additions & 2 deletions moto/organizations/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ class AlreadyInOrganizationException(JsonRESTError):

def __init__(self) -> None:
super().__init__(
"AlreadyInOrganizationException", "The provided account is already a member of an organization."
"AlreadyInOrganizationException",
"The provided account is already a member of an organization.",
)


class AWSOrganizationsNotInUseException(JsonRESTError):
code = 400

Expand Down Expand Up @@ -96,7 +98,8 @@ class OrganizationNotEmptyException(JsonRESTError):

def __init__(self) -> None:
super().__init__(
"OrganizationNotEmptyException", "To delete an organization you must first remove all member accounts (except the master).",
"OrganizationNotEmptyException",
"To delete an organization you must first remove all member accounts (except the master).",
)


Expand Down
14 changes: 11 additions & 3 deletions moto/organizations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
AccountAlreadyRegisteredException,
AccountNotFoundException,
AccountNotRegisteredException,
AlreadyInOrganizationException,
AWSOrganizationsNotInUseException,
ConstraintViolationException,
DuplicateOrganizationalUnitException,
DuplicatePolicyException,
InvalidInputException,
OrganizationNotEmptyException,
PolicyNotFoundException,
PolicyTypeAlreadyEnabledException,
PolicyTypeNotEnabledException,
RootNotFoundException,
TargetNotFoundException, AlreadyInOrganizationException, OrganizationNotEmptyException,
TargetNotFoundException,
)
from moto.utilities.paginator import paginate
from moto.utilities.utils import PARTITION_NAMES, get_partition
Expand Down Expand Up @@ -536,7 +538,10 @@ def list_organizational_units_for_parent(
]

def create_account(self, **kwargs: Any) -> Dict[str, Any]:
if self.org is None or self.account_id not in organizations_backends.master_accounts:
if (
self.org is None
or self.account_id not in organizations_backends.master_accounts
):
raise AWSOrganizationsNotInUseException

new_account = FakeAccount(self.org, **kwargs) # type: ignore
Expand All @@ -549,7 +554,10 @@ def create_account(self, **kwargs: Any) -> Dict[str, Any]:
return new_account.create_account_status

def close_account(self, **kwargs: Any) -> None:
if self.org is None or self.account_id not in organizations_backends.master_accounts:
if (
self.org is None
or self.account_id not in organizations_backends.master_accounts
):
raise AWSOrganizationsNotInUseException

for account in self.accounts:
Expand Down

0 comments on commit 5601d8f

Please sign in to comment.