Skip to content

Commit

Permalink
Add interface update and mock
Browse files Browse the repository at this point in the history
  • Loading branch information
berejant committed Nov 8, 2023
1 parent 9984240 commit 474121e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
const Username = "pigeon"

type ClientInterface interface {
GetAuthUrl(userId string, redirectUri string) (string, error)
GetAuthUrl(userId string, redirectUri string) (authUrl string, expireAt time.Time, err error)
}

type Client struct {
Expand Down
15 changes: 15 additions & 0 deletions Client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package authorizer

import (
"github.com/h2non/gock"
"github.com/kneu-messenger-pigeon/authorizer-client/mocks"
"github.com/kneu-messenger-pigeon/authorizer/dto"
"github.com/stretchr/testify/assert"
"net/url"
Expand Down Expand Up @@ -97,3 +98,17 @@ func TestClient_GetAuthUrl(t *testing.T) {
})

}

func TestIsInterface(t *testing.T) {
var client ClientInterface

t.Run("ClientInterface", func(t *testing.T) {
client = &Client{}
assert.NotNil(t, client)
})

t.Run("MockClientInterface", func(t *testing.T) {
client = mocks.NewClientInterface(t)
assert.NotNil(t, client)
})
}
27 changes: 19 additions & 8 deletions mocks/ClientInterface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 474121e

Please sign in to comment.