@@ -51,7 +51,7 @@ func TestProvider(t *testing.T) {
5151}
5252
5353func TestAccProviderConfigure (t * testing.T ) {
54- t .Run ("can be configured to run anonymously " , func (t * testing.T ) {
54+ t .Run ("can_be_configured_to_run_anonymously " , func (t * testing.T ) {
5555 config := `
5656 provider "github" {
5757 }
@@ -71,10 +71,36 @@ func TestAccProviderConfigure(t *testing.T) {
7171 })
7272 })
7373
74+ t .Run ("can_be_configured_with_app_auth_and_ignore_github_token" , func (t * testing.T ) {
75+ t .Skip ("This test requires a valid app auth setup to run." )
76+ config := fmt .Sprintf (`
77+ provider "github" {
78+ owner = "%s"
79+ app_auth {
80+ id = "1234567890"
81+ installation_id = "1234567890"
82+ pem_file = "1234567890"
83+ }
84+ }
85+
86+ data "github_ip_ranges" "test" {}
87+ ` , testAccConf .owner )
88+
89+ resource .Test (t , resource.TestCase {
90+ PreCheck : func () { t .Setenv ("GITHUB_TOKEN" , "1234567890" ) },
91+ ProviderFactories : providerFactories ,
92+ Steps : []resource.TestStep {
93+ {
94+ Config : config ,
95+ ExpectNonEmptyPlan : false ,
96+ },
97+ },
98+ })
99+ })
100+
74101 t .Run ("can be configured to run insecurely" , func (t * testing.T ) {
75102 config := `
76103 provider "github" {
77- token = ""
78104 insecure = true
79105 }
80106 data "github_ip_ranges" "test" {}
@@ -231,6 +257,7 @@ func TestAccProviderConfigure(t *testing.T) {
231257 })
232258 })
233259 t .Run ("should not allow both token and app_auth to be configured" , func (t * testing.T ) {
260+ t .Skip ("This would be a semver breaking change, this will be reinstated for v7." )
234261 config := fmt .Sprintf (`
235262 provider "github" {
236263 owner = "%s"
@@ -255,29 +282,4 @@ func TestAccProviderConfigure(t *testing.T) {
255282 },
256283 })
257284 })
258- t .Run ("should not allow app_auth and GITHUB_TOKEN to be configured" , func (t * testing.T ) {
259- config := fmt .Sprintf (`
260- provider "github" {
261- owner = "%s"
262- app_auth {
263- id = "1234567890"
264- installation_id = "1234567890"
265- pem_file = "1234567890"
266- }
267- }
268-
269- data "github_ip_ranges" "test" {}
270- ` , testAccConf .owner )
271-
272- resource .Test (t , resource.TestCase {
273- PreCheck : func () { t .Setenv ("GITHUB_TOKEN" , "1234567890" ) },
274- ProviderFactories : providerFactories ,
275- Steps : []resource.TestStep {
276- {
277- Config : config ,
278- ExpectError : regexp .MustCompile (`"token": conflicts with app_auth` ),
279- },
280- },
281- })
282- })
283285}
0 commit comments