Skip to content

Commit

Permalink
test: add test for new function
Browse files Browse the repository at this point in the history
  • Loading branch information
BarcoMasile committed Feb 6, 2024
1 parent 7f217fe commit 6214f7f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pkg/kratos/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/stretchr/testify/assert"
"io"
"net/http"
"net/http/httptest"
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 6214f7f

Please sign in to comment.