示例#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")
示例#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"}
     ]
示例#3
0
文件: models.py 项目: copland/moto
 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')
示例#5
0
文件: models.py 项目: stedesDev/moto
 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')
示例#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")
示例#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"
         }
     ]
示例#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")
示例#10
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')
示例#11
0
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)
示例#12
0
def test_make_random_root_id():
    root_id = utils.make_random_root_id()
    root_id.should.match(utils.ROOT_ID_REGEX)