Beispiel #1
0
def test_list_organizational_units_for_parent_exception():
    client = boto3.client("organizations", region_name="us-east-1")
    with assert_raises(ClientError) as e:
        response = client.list_organizational_units_for_parent(
            ParentId=utils.make_random_root_id())
    ex = e.exception
    ex.operation_name.should.equal("ListOrganizationalUnitsForParent")
    ex.response["Error"]["Code"].should.equal("400")
    ex.response["Error"]["Message"].should.contain("ParentNotFoundException")
Beispiel #2
0
 def __init__(self, feature_set):
     self.id = utils.make_random_org_id()
     self.root_id = utils.make_random_root_id()
     self.feature_set = feature_set
     self.master_account_id = utils.MASTER_ACCOUNT_ID
     self.master_account_email = utils.MASTER_ACCOUNT_EMAIL
     self.available_policy_types = [
         {"Type": "SERVICE_CONTROL_POLICY", "Status": "ENABLED"}
     ]
Beispiel #3
0
 def __init__(self, feature_set):
     self.id = utils.make_random_org_id()
     self.root_id = utils.make_random_root_id()
     self.feature_set = feature_set
     self.master_account_id = utils.MASTER_ACCOUNT_ID
     self.master_account_email = utils.MASTER_ACCOUNT_EMAIL
     self.available_policy_types = [{
         'Type': 'SERVICE_CONTROL_POLICY',
         'Status': 'ENABLED'
     }]
def test_list_organizational_units_for_parent_exception():
    client = boto3.client('organizations', region_name='us-east-1')
    with assert_raises(ClientError) as e:
        response = client.list_organizational_units_for_parent(
            ParentId=utils.make_random_root_id()
        )
    ex = e.exception
    ex.operation_name.should.equal('ListOrganizationalUnitsForParent')
    ex.response['Error']['Code'].should.equal('400')
    ex.response['Error']['Message'].should.contain('ParentNotFoundException')
Beispiel #5
0
 def __init__(self, feature_set):
     self.id = utils.make_random_org_id()
     self.root_id = utils.make_random_root_id()
     self.feature_set = feature_set
     self.master_account_id = utils.MASTER_ACCOUNT_ID
     self.master_account_email = utils.MASTER_ACCOUNT_EMAIL
     self.available_policy_types = [
         # TODO: verify if this should be enabled by default (breaks TF tests for CloudTrail)
         {"Type": "SERVICE_CONTROL_POLICY", "Status": "ENABLED"}
     ]
def test_describe_organizational_unit_exception():
    client = boto3.client('organizations', region_name='us-east-1')
    org = client.create_organization(FeatureSet='ALL')['Organization']
    with assert_raises(ClientError) as e:
        response = client.describe_organizational_unit(
            OrganizationalUnitId=utils.make_random_root_id()
        )
    ex = e.exception
    ex.operation_name.should.equal('DescribeOrganizationalUnit')
    ex.response['Error']['Code'].should.equal('400')
    ex.response['Error']['Message'].should.contain('OrganizationalUnitNotFoundException')
Beispiel #7
0
def test_describe_organizational_unit_exception():
    client = boto3.client("organizations", region_name="us-east-1")
    org = client.create_organization(FeatureSet="ALL")["Organization"]
    with assert_raises(ClientError) as e:
        response = client.describe_organizational_unit(
            OrganizationalUnitId=utils.make_random_root_id())
    ex = e.exception
    ex.operation_name.should.equal("DescribeOrganizationalUnit")
    ex.response["Error"]["Code"].should.equal("400")
    ex.response["Error"]["Message"].should.contain(
        "OrganizationalUnitNotFoundException")
Beispiel #8
0
 def __init__(self, feature_set):
     self.id = utils.make_random_org_id()
     self.root_id = utils.make_random_root_id()
     self.feature_set = feature_set
     self.master_account_id = utils.MASTER_ACCOUNT_ID
     self.master_account_email = utils.MASTER_ACCOUNT_EMAIL
     self.available_policy_types = [
         # This policy is available, but not applied
         # User should use enable_policy_type/disable_policy_type to do anything else
         # This field is deprecated in AWS, but we'll return it for old time's sake
         {
             "Type": "SERVICE_CONTROL_POLICY",
             "Status": "ENABLED"
         }
     ]
Beispiel #9
0
def test_list_children_exception():
    client = boto3.client("organizations", region_name="us-east-1")
    org = client.create_organization(FeatureSet="ALL")["Organization"]
    root_id = client.list_roots()["Roots"][0]["Id"]
    with assert_raises(ClientError) as e:
        response = client.list_children(ParentId=utils.make_random_root_id(),
                                        ChildType="ACCOUNT")
    ex = e.exception
    ex.operation_name.should.equal("ListChildren")
    ex.response["Error"]["Code"].should.equal("400")
    ex.response["Error"]["Message"].should.contain("ParentNotFoundException")
    with assert_raises(ClientError) as e:
        response = client.list_children(ParentId=root_id, ChildType="BLEE")
    ex = e.exception
    ex.operation_name.should.equal("ListChildren")
    ex.response["Error"]["Code"].should.equal("400")
    ex.response["Error"]["Message"].should.contain("InvalidInputException")
def test_list_children_exception():
    client = boto3.client('organizations', region_name='us-east-1')
    org = client.create_organization(FeatureSet='ALL')['Organization']
    root_id = client.list_roots()['Roots'][0]['Id']
    with assert_raises(ClientError) as e:
        response = client.list_children(
            ParentId=utils.make_random_root_id(),
            ChildType='ACCOUNT'
        )
    ex = e.exception
    ex.operation_name.should.equal('ListChildren')
    ex.response['Error']['Code'].should.equal('400')
    ex.response['Error']['Message'].should.contain('ParentNotFoundException')
    with assert_raises(ClientError) as e:
        response = client.list_children(
            ParentId=root_id,
            ChildType='BLEE'
        )
    ex = e.exception
    ex.operation_name.should.equal('ListChildren')
    ex.response['Error']['Code'].should.equal('400')
    ex.response['Error']['Message'].should.contain('InvalidInputException')
def test_make_random_ou_id():
    root_id = utils.make_random_root_id()
    ou_id = utils.make_random_ou_id(root_id)
    ou_id.should.match(utils.OU_ID_REGEX)
def test_make_random_root_id():
    root_id = utils.make_random_root_id()
    root_id.should.match(utils.ROOT_ID_REGEX)