Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
Signed-off-by: ddl-rliu <[email protected]>
  • Loading branch information
ddl-rliu committed Apr 9, 2024
1 parent 3bf7ea8 commit 59be1f3
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions flyteadmin/auth/auth_context_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package auth

import (
"testing"

"github.com/stretchr/testify/assert"
"golang.org/x/oauth2"

"github.com/flyteorg/flyte/flyteadmin/auth/config"
)

func TestOAuth2ClientConfig(t *testing.T) {
type test struct {
name string
url string
expectedRedirectURL string
}
tests := []test{
{
name: "simple publicUrl",
url: "https://flyte.com",
expectedRedirectURL: "https://flyte.com/callback",
},
{
name: "custom subpath",
url: "https://flyte.com/custom-subpath/console",
expectedRedirectURL: "https://flyte.com/custom-subpath/callback",
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
authCtx := Context{
oauth2Client: &oauth2.Config{},
}
cfg := authCtx.OAuth2ClientConfig(config.MustParseURL(tt.url))
assert.Equal(t, tt.expectedRedirectURL, cfg.RedirectURL)
})
}
}

0 comments on commit 59be1f3

Please sign in to comment.