Fix group limits and original azure unit tests

This commit is contained in:
Pavel Sorokin 2017-02-06 22:04:36 +07:00 committed by Brandon Matthews
parent b546ef4a3f
commit 342cac58ca
3 changed files with 10 additions and 10 deletions

View File

@ -219,5 +219,5 @@ func (p *AzureProvider) ValidateGroup(s *SessionState) bool {
}
}
}
return false
return true
}

View File

@ -38,9 +38,9 @@ func TestAzureProviderDefaults(t *testing.T) {
p.Data().LoginURL.String())
assert.Equal(t, "https://login.microsoftonline.com/common/oauth2/token",
p.Data().RedeemURL.String())
assert.Equal(t, "https://graph.windows.net/me?api-version=1.6",
assert.Equal(t, "https://graph.microsoft.com/v1.0/me",
p.Data().ProfileURL.String())
assert.Equal(t, "https://graph.windows.net",
assert.Equal(t, "https://graph.microsoft.com",
p.Data().ProtectedResource.String())
assert.Equal(t, "",
p.Data().ValidateURL.String())
@ -94,9 +94,9 @@ func TestAzureSetTenant(t *testing.T) {
p.Data().LoginURL.String())
assert.Equal(t, "https://login.microsoftonline.com/example/oauth2/token",
p.Data().RedeemURL.String())
assert.Equal(t, "https://graph.windows.net/me?api-version=1.6",
assert.Equal(t, "https://graph.microsoft.com/v1.0/me",
p.Data().ProfileURL.String())
assert.Equal(t, "https://graph.windows.net",
assert.Equal(t, "https://graph.microsoft.com",
p.Data().ProtectedResource.String())
assert.Equal(t, "",
p.Data().ValidateURL.String())
@ -104,8 +104,8 @@ func TestAzureSetTenant(t *testing.T) {
}
func testAzureBackend(payload string) *httptest.Server {
path := "/me"
query := "api-version=1.6"
path := "/v1.0/me"
query := ""
return httptest.NewServer(http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {

View File

@ -110,16 +110,16 @@ func TestGoogleProviderValidateGroup(t *testing.T) {
p.GroupValidator = func(email string) bool {
return email == "michael.bland@gsa.gov"
}
assert.Equal(t, true, p.ValidateGroup("michael.bland@gsa.gov"))
assert.Equal(t, true, p.ValidateGroup(&SessionState{Email:"michael.bland@gsa.gov"}))
p.GroupValidator = func(email string) bool {
return email != "michael.bland@gsa.gov"
}
assert.Equal(t, false, p.ValidateGroup("michael.bland@gsa.gov"))
assert.Equal(t, false, p.ValidateGroup(&SessionState{Email:"michael.bland@gsa.gov"}))
}
func TestGoogleProviderWithoutValidateGroup(t *testing.T) {
p := newGoogleProvider()
assert.Equal(t, true, p.ValidateGroup("michael.bland@gsa.gov"))
assert.Equal(t, true, p.ValidateGroup(&SessionState{Email:"michael.bland@gsa.gov"}))
}
//