MCPcopy Create free account
hub / github.com/UiPath/uipathcli / TestOAuthAuthenticatorInvalidConfig

Function TestOAuthAuthenticatorInvalidConfig

auth/oauth_authenticator_test.go:42–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func TestOAuthAuthenticatorInvalidConfig(t *testing.T) {
43 config := map[string]interface{}{
44 "clientId": 1,
45 "redirectUri": "http://localhost:0",
46 "scopes": "OR.Users",
47 }
48 url, _ := url.Parse("http:/localhost")
49 context := createAuthContext(*url, config, false, io.Discard)
50
51 authenticator := NewOAuthAuthenticator(cache.NewFileCache(), *NewBrowserLauncher())
52 result := authenticator.Auth(context)
53 if result.Error != "Invalid oauth authenticator configuration: Invalid value for clientId: '1'" {
54 t.Errorf("Expected error with invalid config, but got: %v", result.Error)
55 }
56}
57
58func TestOAuthFlowIdentityFails(t *testing.T) {
59 identityServerFake := identityServerFake{

Callers

nothing calls this directly

Calls 6

AuthMethod · 0.95
NewFileCacheFunction · 0.92
createAuthContextFunction · 0.85
NewOAuthAuthenticatorFunction · 0.85
NewBrowserLauncherFunction · 0.85
ParseMethod · 0.65

Tested by

no test coverage detected