renaming, mocking and begin tests
This commit is contained in:
parent
3d5de74d02
commit
85b71e0867
14 changed files with 309 additions and 18 deletions
37
pkg/op/mock/sotrage.mock.impl.go
Normal file
37
pkg/op/mock/sotrage.mock.impl.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package mock
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
|
||||
"github.com/caos/oidc/pkg/op"
|
||||
)
|
||||
|
||||
func NewStorage(t *testing.T) op.Storage {
|
||||
return NewMockStorage(gomock.NewController(t))
|
||||
}
|
||||
|
||||
func NewMockStorageExpectValidClientID(t *testing.T) op.Storage {
|
||||
m := NewStorage(t)
|
||||
ExpectValidClientID(m)
|
||||
return m
|
||||
}
|
||||
|
||||
func ExpectValidClientID(s op.Storage) {
|
||||
mockS := s.(*MockStorage)
|
||||
mockS.EXPECT().GetClientByClientID(gomock.Any()).Return(&ConfClient{}, nil)
|
||||
}
|
||||
|
||||
type ConfClient struct{}
|
||||
|
||||
func (c *ConfClient) Type() op.ClientType {
|
||||
return op.ClientTypeConfidential
|
||||
}
|
||||
func (c *ConfClient) RedirectURIs() []string {
|
||||
return []string{
|
||||
"https://registered.com/callback",
|
||||
"http://localhost:9999/callback",
|
||||
"custom://callback",
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue