-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relocate provider specific validation logic
- Loading branch information
1 parent
cb40882
commit 3b439f6
Showing
5 changed files
with
55 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1635,8 +1635,9 @@ func TestHostHeader(t *testing.T) { | |
} | ||
} | ||
|
||
func TestDefaultProviderApiSettings(t *testing.T) { | ||
func TestGoogleProviderApiSettings(t *testing.T) { | ||
opts := testOpts("abced", "testtest") | ||
opts.Provider = "google" | ||
opts.Validate() | ||
proxy, _ := NewAuthenticator(opts, AssignProvider(opts), func(p *Authenticator) error { | ||
p.Validator = func(string) bool { return true } | ||
|
@@ -1653,6 +1654,7 @@ func TestDefaultProviderApiSettings(t *testing.T) { | |
|
||
func TestGoogleGroupInvalidFile(t *testing.T) { | ||
opts := testOpts("abced", "testtest") | ||
opts.Provider = "google" | ||
opts.GoogleAdminEmail = "[email protected]" | ||
opts.GoogleServiceAccountJSON = "file_doesnt_exist.json" | ||
opts.Validate() | ||
|
@@ -1663,3 +1665,14 @@ func TestGoogleGroupInvalidFile(t *testing.T) { | |
testutil.NotEqual(t, nil, err) | ||
testutil.Equal(t, "invalid Google credentials file: file_doesnt_exist.json", err.Error()) | ||
} | ||
|
||
func TestUnimplementedProvider(t *testing.T) { | ||
opts := testOpts("abced", "testtest") | ||
opts.Validate() | ||
_, err := NewAuthenticator(opts, AssignProvider(opts), func(p *Authenticator) error { | ||
p.Validator = func(string) bool { return true } | ||
return nil | ||
}) | ||
testutil.NotEqual(t, nil, err) | ||
testutil.Equal(t, "unimplemented provider: \"\"", err.Error()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters