diff --git a/pkg/kratos/service_test.go b/pkg/kratos/service_test.go index b11964fcf..243e29c73 100644 --- a/pkg/kratos/service_test.go +++ b/pkg/kratos/service_test.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "fmt" + "github.com/stretchr/testify/assert" "io" "net/http" "net/http/httptest" @@ -731,6 +732,24 @@ func TestCheckAllowedProviderFail(t *testing.T) { } } +func TestGetClientNameOAuthKeeper(t *testing.T) { + loginFlow := &kClient.LoginFlow{} + + actualClientName := getClientName(loginFlow) + + const expectedClientName = "" + assert.Equal(t, expectedClientName, actualClientName) +} + +func TestGetClientNameOAuth2Request(t *testing.T) { + expectedClientName := "mockClientName" + loginFlow := &kClient.LoginFlow{Oauth2LoginRequest: &kClient.OAuth2LoginRequest{Client: &kClient.OAuth2Client{ClientName: &expectedClientName}}} + + actualClientName := getClientName(loginFlow) + + assert.Equal(t, expectedClientName, actualClientName) +} + func TestFilterFlowProviderListAllowAll(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish()