github.com/bradfeehan/terraform@v0.7.0-rc3.0.20170529055808-34b45c5ad841/builtin/providers/github/data_source_github_team_test.go (about) 1 package github 2 3 import ( 4 "fmt" 5 "regexp" 6 "testing" 7 8 "github.com/hashicorp/terraform/helper/resource" 9 ) 10 11 func TestAccGithubTeamDataSource_noMatchReturnsError(t *testing.T) { 12 slug := "non-existing" 13 resource.Test(t, resource.TestCase{ 14 PreCheck: func() { 15 testAccPreCheck(t) 16 }, 17 Providers: testAccProviders, 18 Steps: []resource.TestStep{ 19 { 20 Config: testAccCheckGithubTeamDataSourceConfig(slug), 21 ExpectError: regexp.MustCompile(`Could not find team`), 22 }, 23 }, 24 }) 25 } 26 27 func testAccCheckGithubTeamDataSourceConfig(slug string) string { 28 return fmt.Sprintf(` 29 data "github_team" "test" { 30 slug = "%s" 31 } 32 `, slug) 33 }