You've already forked oauth2-proxy
mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2025-07-15 01:44:22 +02:00
Cleaned up source to make golangci-lint pass (#418)
* cleaned up source to make golangci-lint pass * providers/azure_test.go: use build in POST constant * options_test.go: do not export unnecessary variables Co-authored-by: Joel Speed <Joel.speed@hotmail.co.uk>
This commit is contained in:
@ -13,12 +13,16 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
const cookieSecret = "foobar"
|
||||
const clientID = "bazquux"
|
||||
const clientSecret = "xyzzyplugh"
|
||||
|
||||
func testOptions() *Options {
|
||||
o := NewOptions()
|
||||
o.Upstreams = append(o.Upstreams, "http://127.0.0.1:8080/")
|
||||
o.CookieSecret = "foobar"
|
||||
o.ClientID = "bazquux"
|
||||
o.ClientSecret = "xyzzyplugh"
|
||||
o.CookieSecret = cookieSecret
|
||||
o.ClientID = clientID
|
||||
o.ClientSecret = clientSecret
|
||||
o.EmailDomains = []string{"*"}
|
||||
return o
|
||||
}
|
||||
@ -45,15 +49,15 @@ func TestNewOptions(t *testing.T) {
|
||||
|
||||
func TestClientSecretFileOptionFails(t *testing.T) {
|
||||
o := NewOptions()
|
||||
o.CookieSecret = "foobar"
|
||||
o.ClientID = "bazquux"
|
||||
o.ClientSecretFile = "xyzzyplugh"
|
||||
o.CookieSecret = cookieSecret
|
||||
o.ClientID = clientID
|
||||
o.ClientSecretFile = clientSecret
|
||||
o.EmailDomains = []string{"*"}
|
||||
err := o.Validate()
|
||||
assert.NotEqual(t, nil, err)
|
||||
|
||||
p := o.provider.Data()
|
||||
assert.Equal(t, "xyzzyplugh", p.ClientSecretFile)
|
||||
assert.Equal(t, clientSecret, p.ClientSecretFile)
|
||||
assert.Equal(t, "", p.ClientSecret)
|
||||
|
||||
s, err := p.GetClientSecret()
|
||||
@ -75,8 +79,8 @@ func TestClientSecretFileOption(t *testing.T) {
|
||||
defer os.Remove(clientSecretFileName)
|
||||
|
||||
o := NewOptions()
|
||||
o.CookieSecret = "foobar"
|
||||
o.ClientID = "bazquux"
|
||||
o.CookieSecret = cookieSecret
|
||||
o.ClientID = clientID
|
||||
o.ClientSecretFile = clientSecretFileName
|
||||
o.EmailDomains = []string{"*"}
|
||||
err = o.Validate()
|
||||
|
Reference in New Issue
Block a user