forked from integrations/terraform-provider-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrationsGH-144 - Adding initial testing
- Loading branch information
1 parent
e66bc6a
commit 3d903f1
Showing
2 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package github | ||
|
||
import ( | ||
"fmt" | ||
"regexp" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform/helper/resource" | ||
) | ||
|
||
func TestAccGithubReleaseDataSource_fetchByLatestNoReleaseReturnsError(t *testing.T) { | ||
repo := "nonExistantRepo" | ||
owner := "no-user" | ||
retrieveBy := "latest" | ||
resource.ParallelTest(t, resource.TestCase{ | ||
PreCheck: func() { | ||
testAccPreCheck(t) | ||
}, | ||
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccCheckGithubReleaseDataSourceConfig(repo, owner, retrieveBy), | ||
ExpectError: regexp.MustCompile(`Not Found`), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
// func TestAccGithubReleaseDataSource_latestExisting(t *testing.T) { | ||
|
||
// } | ||
|
||
// func TestAccGithubReleaseDataSource_fetchByIdWithNoIdReturnsError(t *testing.T) { | ||
|
||
// } | ||
|
||
// func TestAccGithubReleaseDataSource_fetchByIdExisting(t *testing.T) { | ||
|
||
// } | ||
|
||
// func TestAccGithubReleaseDataSource_fetchByTagNoTagReturnsError(t *testing.T) { | ||
|
||
// } | ||
|
||
// func TestAccGithubReleaseDataSource_fetchByTagExisting(t *testing.T) { | ||
|
||
// } | ||
|
||
// func TestAccGithubReleaseDataSource_invalidRetrieveMethodReturnsError(t *testing.T) { | ||
|
||
// } | ||
|
||
func testAccCheckGithubReleaseDataSourceConfig(repo string, owner string, retrieveBy string) string { | ||
return fmt.Sprintf(` | ||
data "github_release" "test" { | ||
repository = "%s" | ||
owner = "%s" | ||
retrieve_by = "%s" | ||
} | ||
`, repo, owner, retrieveBy) | ||
} |