oauth2: long if condition in providerAuthHeaderWorks replaced with loop

Long if condition replaced with loop.

Related to issue #41.

Change-Id: Ib5b88ce2ee2841e9b6c24d78f93bb027141bf678
Reviewed-on: https://go-review.googlesource.com/7290
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: Burcu Dogan <jbd@google.com>
This commit is contained in:
Nikolay Turpitko
2015-03-10 14:28:17 +06:00
committed by Burcu Dogan
parent 6d4eed4495
commit 2167774341
2 changed files with 37 additions and 14 deletions

View File

@@ -407,3 +407,20 @@ func TestConfigClientWithToken(t *testing.T) {
t.Error(err)
}
}
func Test_providerAuthHeaderWorks(t *testing.T) {
for _, p := range brokenAuthHeaderProviders {
if providerAuthHeaderWorks(p) {
t.Errorf("URL: %s not found in list", p)
}
p := fmt.Sprintf("%ssomesuffix", p)
if providerAuthHeaderWorks(p) {
t.Errorf("URL: %s not found in list", p)
}
}
p := "https://api.not-in-the-list-example.com/"
if !providerAuthHeaderWorks(p) {
t.Errorf("URL: %s found in list", p)
}
}