update aws_iam_group tests to check proper paths and name
This commit is contained in:
parent
6a2d3eaa6b
commit
8fcc13adbc
|
@ -23,14 +23,14 @@ func TestAccAWSIAMGroup_basic(t *testing.T) {
|
||||||
Config: testAccAWSGroupConfig,
|
Config: testAccAWSGroupConfig,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckAWSGroupExists("aws_iam_group.group", &conf),
|
testAccCheckAWSGroupExists("aws_iam_group.group", &conf),
|
||||||
testAccCheckAWSGroupAttributes(&conf),
|
testAccCheckAWSGroupAttributes(&conf, "test-group", "/"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
resource.TestStep{
|
resource.TestStep{
|
||||||
Config: testAccAWSGroupConfig2,
|
Config: testAccAWSGroupConfig2,
|
||||||
Check: resource.ComposeTestCheckFunc(
|
Check: resource.ComposeTestCheckFunc(
|
||||||
testAccCheckAWSGroupExists("aws_iam_group.group", &conf),
|
testAccCheckAWSGroupExists("aws_iam_group.group", &conf),
|
||||||
testAccCheckAWSGroupAttributes(&conf),
|
testAccCheckAWSGroupAttributes(&conf, "test-group2", "/funnypath/"),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -92,14 +92,14 @@ func testAccCheckAWSGroupExists(n string, res *iam.GetGroupOutput) resource.Test
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testAccCheckAWSGroupAttributes(group *iam.GetGroupOutput) resource.TestCheckFunc {
|
func testAccCheckAWSGroupAttributes(group *iam.GetGroupOutput, name string, path string) resource.TestCheckFunc {
|
||||||
return func(s *terraform.State) error {
|
return func(s *terraform.State) error {
|
||||||
if *group.Group.GroupName != "test-group" {
|
if *group.Group.GroupName != name {
|
||||||
return fmt.Errorf("Bad name: %s", *group.Group.GroupName)
|
return fmt.Errorf("Bad name: %s when %s was expected", *group.Group.GroupName, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *group.Group.Path != "/" {
|
if *group.Group.Path != path {
|
||||||
return fmt.Errorf("Bad path: %s", *group.Group.Path)
|
return fmt.Errorf("Bad path: %s when %s was expected", *group.Group.Path, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue