diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2017-01-15 21:50:38 +0000 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2017-01-15 22:43:41 +0000 |
commit | 17b17fc8bb690d1f6344e5af1c62b3b37166bc48 (patch) | |
tree | 8e50f8ea3f5a38002447021e7fdcacfa48c4c9cd /server/auth/github | |
parent | d3d2d5384cbb53c91c321c552cc56b42c90437fa (diff) |
Add more context to errors
Diffstat (limited to 'server/auth/github')
-rw-r--r-- | server/auth/github/github.go | 2 | ||||
-rw-r--r-- | server/auth/github/github_test.go | 8 |
2 files changed, 4 insertions, 6 deletions
diff --git a/server/auth/github/github.go b/server/auth/github/github.go index 24a4bbf..7628526 100644 --- a/server/auth/github/github.go +++ b/server/auth/github/github.go @@ -32,7 +32,7 @@ func New(c *config.Auth) (auth.Provider, error) { uw[u] = true } if c.ProviderOpts["organization"] == "" && len(uw) == 0 { - return nil, errors.New("github_opts organization and the users whitelist must not be both empty") + return nil, errors.New("either GitHub organization or users whitelist must be specified") } return &Config{ config: &oauth2.Config{ diff --git a/server/auth/github/github_test.go b/server/auth/github/github_test.go index c0b26a4..b0c97d2 100644 --- a/server/auth/github/github_test.go +++ b/server/auth/github/github_test.go @@ -29,11 +29,9 @@ func TestNew(t *testing.T) { func TestNewEmptyOrganization(t *testing.T) { organization = "" - a := assert.New(t) - - _, err := newGithub() - a.EqualError(err, "github_opts organization and the users whitelist must not be both empty") - + if _, err := newGithub(); err == nil { + t.Error("creating a provider without an organization set should return an error") + } organization = "exampleorg" } |