From d0845a0d87c38b8d5ac722d1a0362b23669f9cfc Mon Sep 17 00:00:00 2001 From: Angie Pinilla <angelinepinilla@gmail.com> Date: Tue, 14 Apr 2020 20:42:45 -0400 Subject: [PATCH 1/3] add /orgs mockgithub api endpoint in provider test --- github/provider_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/github/provider_test.go b/github/provider_test.go index c503065ffc..efa223fbd1 100644 --- a/github/provider_test.go +++ b/github/provider_test.go @@ -199,6 +199,7 @@ func githubTLSApiMock(port, certFile, keyFile string, t *testing.T) (string, fun mux.HandleFunc("/users/hashibot", testRespondJson(userResponseBody)) mux.HandleFunc("/users/hashibot/gpg_keys", testRespondJson(gpgKeysResponseBody)) mux.HandleFunc("/users/hashibot/keys", testRespondJson(keysResponseBody)) + mux.HandleFunc("/orgs/"+testOrganization, testRespondJson(orgResponseBody(port))) server := &http.Server{ Addr: ":" + port, @@ -317,3 +318,14 @@ const keysResponseBody = `[ "key": "ssh-rsa AAA..." } ]` + +func orgResponseBody(port string) string { + url := fmt.Sprintf(`https://localhost:%s/orgs/%s`, port, testOrganization) + return fmt.Sprintf(` +{ + "login": "%s", + "url" : "%s", + "repos_url": "%s/repos" +} +`, testOrganization, url, url) +} From 786615f7d39cc7ec4504ca0595ec6bc87b5dc5a4 Mon Sep 17 00:00:00 2001 From: Angie Pinilla <angelinepinilla@gmail.com> Date: Tue, 14 Apr 2020 21:07:22 -0400 Subject: [PATCH 2/3] rename to acceptance prefix --- github/provider_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github/provider_test.go b/github/provider_test.go index efa223fbd1..0085da6e19 100644 --- a/github/provider_test.go +++ b/github/provider_test.go @@ -70,7 +70,7 @@ func testAccPreCheck(t *testing.T) { } } -func TestProvider_individual(t *testing.T) { +func TestAccProvider_individual(t *testing.T) { username := "hashibot" resource.ParallelTest(t, resource.TestCase{ @@ -110,7 +110,7 @@ func TestProvider_individual(t *testing.T) { }) } -func TestProvider_anonymous(t *testing.T) { +func TestAccProvider_anonymous(t *testing.T) { username := "hashibot" resource.Test(t, resource.TestCase{ @@ -144,7 +144,7 @@ func TestProvider_anonymous(t *testing.T) { }) } -func TestProvider_insecure(t *testing.T) { +func TestAccProvider_insecure(t *testing.T) { // Use ephemeral port range (49152–65535) port := fmt.Sprintf("%d", 49152+rand.Intn(16382)) From b5c68efc6adc7f1c593c2e1a1df30231cd757237 Mon Sep 17 00:00:00 2001 From: Angie Pinilla <angelinepinilla@gmail.com> Date: Tue, 14 Apr 2020 21:47:53 -0400 Subject: [PATCH 3/3] validate certificate for untrusted --- .github/workflows/acceptance-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 35e90b1d5d..028f636d8a 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -34,7 +34,7 @@ jobs: - name: Generate Test Fixtures run: | openssl req -x509 -newkey rsa:4096 -days 1 -nodes \ - -subj "/C=US/ST=CA/L=San Francisco/O=HashiCorp, Inc./CN=localhost" \ + -subj "/C=US/ST=CA/L=San Francisco/O=HashiCorp, Inc./CN=untrusted" \ -keyout github/test-fixtures/key.pem -out github/test-fixtures/cert.pem - name: Acceptance Tests