Make GitHub org comparison case insensitive.

Fixes #1359
This commit is contained in:
Jeff Mitchell
2016-05-02 00:18:31 -04:00
parent 3ee3d2789a
commit e198037788
2 changed files with 14 additions and 4 deletions

View File

@@ -3,6 +3,7 @@ package github
import (
"fmt"
"os"
"strings"
"testing"
"time"
@@ -108,7 +109,11 @@ func TestBackend_basic(t *testing.T) {
PreCheck: func() { testAccPreCheck(t) },
Backend: b,
Steps: []logicaltest.TestStep{
testAccStepConfig(t),
testAccStepConfig(t, false),
testAccMap(t, "default", "root"),
testAccMap(t, "oWnErs", "root"),
testAccLogin(t, []string{"root"}),
testAccStepConfig(t, true),
testAccMap(t, "default", "root"),
testAccMap(t, "oWnErs", "root"),
testAccLogin(t, []string{"root"}),
@@ -134,14 +139,18 @@ func testAccPreCheck(t *testing.T) {
}
}
func testAccStepConfig(t *testing.T) logicaltest.TestStep {
return logicaltest.TestStep{
func testAccStepConfig(t *testing.T, upper bool) logicaltest.TestStep {
ts := logicaltest.TestStep{
Operation: logical.UpdateOperation,
Path: "config",
Data: map[string]interface{}{
"organization": os.Getenv("GITHUB_ORG"),
},
}
if upper {
ts.Data["organization"] = strings.ToUpper(os.Getenv("GITHUB_ORG"))
}
return ts
}
func testAccStepConfigWithBaseURL(t *testing.T) logicaltest.TestStep {