Merge pull request #8644 from kwilczynski/feature/add-unit-test-data_source_availability_zones

provider/aws: Add missing unit test for validateStateType to data_source_availability_zones.
This commit is contained in:
Paul Stack 2016-09-03 16:50:59 +03:00 committed by GitHub
commit 401d976cbb
1 changed files with 28 additions and 0 deletions

View File

@ -32,6 +32,34 @@ func TestAccAWSAvailabilityZones_basic(t *testing.T) {
}) })
} }
func TestResourceCheckAwsAvailabilityZones_validateStateType(t *testing.T) {
_, errors := validateStateType("incorrect", "state")
if len(errors) == 0 {
t.Fatalf("Expected to trigger a validation error")
}
var testCases = []struct {
Value string
ErrCount int
}{
{
Value: "available",
ErrCount: 0,
},
{
Value: "unavailable",
ErrCount: 0,
},
}
for _, tc := range testCases {
_, errors := validateStateType(tc.Value, "state")
if len(errors) != tc.ErrCount {
t.Fatalf("Expected %q not to trigger a validation error.", tc.Value)
}
}
}
func testAccCheckAwsAvailabilityZonesMeta(n string) resource.TestCheckFunc { func testAccCheckAwsAvailabilityZonesMeta(n string) resource.TestCheckFunc {
return func(s *terraform.State) error { return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n] rs, ok := s.RootModule().Resources[n]