(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func TestOAuthAuthenticatorNotEnabled(t *testing.T) { |
| 25 | config := map[string]interface{}{ |
| 26 | "clientId": "my-client-id", |
| 27 | "scopes": "OR.Users", |
| 28 | } |
| 29 | url, _ := url.Parse("http:/localhost") |
| 30 | context := createAuthContext(*url, config, false, io.Discard) |
| 31 | |
| 32 | authenticator := NewOAuthAuthenticator(cache.NewFileCache(), *NewBrowserLauncher()) |
| 33 | result := authenticator.Auth(context) |
| 34 | if result.Error != "" { |
| 35 | t.Errorf("Expected no error when oauth flow is skipped, but got: %v", result.Error) |
| 36 | } |
| 37 | if result.Token != nil { |
| 38 | t.Errorf("Expected auth token to be empty, but got: %v", result.Token) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func TestOAuthAuthenticatorInvalidConfig(t *testing.T) { |
| 43 | config := map[string]interface{}{ |
nothing calls this directly
no test coverage detected