fix
This commit is contained in:
parent
201109f9c2
commit
83807ea767
2 changed files with 22 additions and 7 deletions
|
@ -8,6 +8,7 @@ import (
|
||||||
oidc "github.com/caos/oidc/pkg/oidc"
|
oidc "github.com/caos/oidc/pkg/oidc"
|
||||||
op "github.com/caos/oidc/pkg/op"
|
op "github.com/caos/oidc/pkg/op"
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
|
go_jose_v2 "gopkg.in/square/go-jose.v2"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -137,3 +138,18 @@ func (mr *MockStorageMockRecorder) GetClientByClientID(arg0 interface{}) *gomock
|
||||||
mr.mock.ctrl.T.Helper()
|
mr.mock.ctrl.T.Helper()
|
||||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClientByClientID", reflect.TypeOf((*MockStorage)(nil).GetClientByClientID), arg0)
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetClientByClientID", reflect.TypeOf((*MockStorage)(nil).GetClientByClientID), arg0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetSigningKey mocks base method
|
||||||
|
func (m *MockStorage) GetSigningKey() (go_jose_v2.SigningKey, error) {
|
||||||
|
m.ctrl.T.Helper()
|
||||||
|
ret := m.ctrl.Call(m, "GetSigningKey")
|
||||||
|
ret0, _ := ret[0].(go_jose_v2.SigningKey)
|
||||||
|
ret1, _ := ret[1].(error)
|
||||||
|
return ret0, ret1
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSigningKey indicates an expected call of GetSigningKey
|
||||||
|
func (mr *MockStorageMockRecorder) GetSigningKey() *gomock.Call {
|
||||||
|
mr.mock.ctrl.T.Helper()
|
||||||
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSigningKey", reflect.TypeOf((*MockStorage)(nil).GetSigningKey))
|
||||||
|
}
|
||||||
|
|
|
@ -7,26 +7,25 @@ import (
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
|
|
||||||
"github.com/caos/oidc/pkg/op"
|
"github.com/caos/oidc/pkg/op"
|
||||||
op2 "github.com/caos/oidc/pkg/op"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewStorage(t *testing.T) op2.Storage {
|
func NewStorage(t *testing.T) op.Storage {
|
||||||
return NewMockStorage(gomock.NewController(t))
|
return NewMockStorage(gomock.NewController(t))
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMockStorageExpectValidClientID(t *testing.T) op2.Storage {
|
func NewMockStorageExpectValidClientID(t *testing.T) op.Storage {
|
||||||
m := NewStorage(t)
|
m := NewStorage(t)
|
||||||
ExpectValidClientID(m)
|
ExpectValidClientID(m)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMockStorageExpectInvalidClientID(t *testing.T) op2.Storage {
|
func NewMockStorageExpectInvalidClientID(t *testing.T) op.Storage {
|
||||||
m := NewStorage(t)
|
m := NewStorage(t)
|
||||||
ExpectInvalidClientID(m)
|
ExpectInvalidClientID(m)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMockStorageAny(t *testing.T) op2.Storage {
|
func NewMockStorageAny(t *testing.T) op.Storage {
|
||||||
m := NewStorage(t)
|
m := NewStorage(t)
|
||||||
mockS := m.(*MockStorage)
|
mockS := m.(*MockStorage)
|
||||||
mockS.EXPECT().GetClientByClientID(gomock.Any()).AnyTimes().Return(&ConfClient{}, nil)
|
mockS.EXPECT().GetClientByClientID(gomock.Any()).AnyTimes().Return(&ConfClient{}, nil)
|
||||||
|
@ -34,12 +33,12 @@ func NewMockStorageAny(t *testing.T) op2.Storage {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExpectInvalidClientID(s op2.Storage) {
|
func ExpectInvalidClientID(s op.Storage) {
|
||||||
mockS := s.(*MockStorage)
|
mockS := s.(*MockStorage)
|
||||||
mockS.EXPECT().GetClientByClientID(gomock.Any()).Return(nil, errors.New("client not found"))
|
mockS.EXPECT().GetClientByClientID(gomock.Any()).Return(nil, errors.New("client not found"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExpectValidClientID(s op2.Storage) {
|
func ExpectValidClientID(s op.Storage) {
|
||||||
mockS := s.(*MockStorage)
|
mockS := s.(*MockStorage)
|
||||||
mockS.EXPECT().GetClientByClientID(gomock.Any()).DoAndReturn(
|
mockS.EXPECT().GetClientByClientID(gomock.Any()).DoAndReturn(
|
||||||
func(id string) (op.Client, error) {
|
func(id string) (op.Client, error) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue