Documentation
¶
Index ¶
- type AuthHandlerMock
- type MongoServerMock
- func (mock *MongoServerMock) AcquireImageLock(ctx context.Context, id string) (string, error)
- func (mock *MongoServerMock) AcquireImageLockCalls() []struct{ ... }
- func (mock *MongoServerMock) Checker(ctx context.Context, state *healthcheck.CheckState) error
- func (mock *MongoServerMock) CheckerCalls() []struct{ ... }
- func (mock *MongoServerMock) Close(ctx context.Context) error
- func (mock *MongoServerMock) CloseCalls() []struct{ ... }
- func (mock *MongoServerMock) GetImage(ctx context.Context, id string) (*models.Image, error)
- func (mock *MongoServerMock) GetImageCalls() []struct{ ... }
- func (mock *MongoServerMock) GetImages(ctx context.Context, collectionID string) ([]models.Image, error)
- func (mock *MongoServerMock) GetImagesCalls() []struct{ ... }
- func (mock *MongoServerMock) UnlockImage(lockID string) error
- func (mock *MongoServerMock) UnlockImageCalls() []struct{ ... }
- func (mock *MongoServerMock) UpdateImage(ctx context.Context, id string, image *models.Image) (bool, error)
- func (mock *MongoServerMock) UpdateImageCalls() []struct{ ... }
- func (mock *MongoServerMock) UpsertImage(ctx context.Context, id string, image *models.Image) error
- func (mock *MongoServerMock) UpsertImageCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthHandlerMock ¶
type AuthHandlerMock struct {
// RequireFunc mocks the Require method.
RequireFunc func(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc
// contains filtered or unexported fields
}
AuthHandlerMock is a mock implementation of api.AuthHandler.
func TestSomethingThatUsesAuthHandler(t *testing.T) {
// make and configure a mocked api.AuthHandler
mockedAuthHandler := &AuthHandlerMock{
RequireFunc: func(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc {
panic("mock out the Require method")
},
}
// use mockedAuthHandler in code that requires api.AuthHandler
// and then make assertions.
}
func (*AuthHandlerMock) Require ¶
func (mock *AuthHandlerMock) Require(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc
Require calls RequireFunc.
func (*AuthHandlerMock) RequireCalls ¶
func (mock *AuthHandlerMock) RequireCalls() []struct { Required auth.Permissions Handler http.HandlerFunc }
RequireCalls gets all the calls that were made to Require. Check the length with:
len(mockedAuthHandler.RequireCalls())
type MongoServerMock ¶
type MongoServerMock struct {
// AcquireImageLockFunc mocks the AcquireImageLock method.
AcquireImageLockFunc func(ctx context.Context, id string) (string, error)
// CheckerFunc mocks the Checker method.
CheckerFunc func(ctx context.Context, state *healthcheck.CheckState) error
// CloseFunc mocks the Close method.
CloseFunc func(ctx context.Context) error
// GetImageFunc mocks the GetImage method.
GetImageFunc func(ctx context.Context, id string) (*models.Image, error)
// GetImagesFunc mocks the GetImages method.
GetImagesFunc func(ctx context.Context, collectionID string) ([]models.Image, error)
// UnlockImageFunc mocks the UnlockImage method.
UnlockImageFunc func(lockID string) error
// UpdateImageFunc mocks the UpdateImage method.
UpdateImageFunc func(ctx context.Context, id string, image *models.Image) (bool, error)
// UpsertImageFunc mocks the UpsertImage method.
UpsertImageFunc func(ctx context.Context, id string, image *models.Image) error
// contains filtered or unexported fields
}
MongoServerMock is a mock implementation of api.MongoServer.
func TestSomethingThatUsesMongoServer(t *testing.T) {
// make and configure a mocked api.MongoServer
mockedMongoServer := &MongoServerMock{
AcquireImageLockFunc: func(ctx context.Context, id string) (string, error) {
panic("mock out the AcquireImageLock method")
},
CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
panic("mock out the Checker method")
},
CloseFunc: func(ctx context.Context) error {
panic("mock out the Close method")
},
GetImageFunc: func(ctx context.Context, id string) (*models.Image, error) {
panic("mock out the GetImage method")
},
GetImagesFunc: func(ctx context.Context, collectionID string) ([]models.Image, error) {
panic("mock out the GetImages method")
},
UnlockImageFunc: func(lockID string) error {
panic("mock out the UnlockImage method")
},
UpdateImageFunc: func(ctx context.Context, id string, image *models.Image) (bool, error) {
panic("mock out the UpdateImage method")
},
UpsertImageFunc: func(ctx context.Context, id string, image *models.Image) error {
panic("mock out the UpsertImage method")
},
}
// use mockedMongoServer in code that requires api.MongoServer
// and then make assertions.
}
func (*MongoServerMock) AcquireImageLock ¶ added in v0.8.0
AcquireImageLock calls AcquireImageLockFunc.
func (*MongoServerMock) AcquireImageLockCalls ¶ added in v0.8.0
func (mock *MongoServerMock) AcquireImageLockCalls() []struct { Ctx context.Context ID string }
AcquireImageLockCalls gets all the calls that were made to AcquireImageLock. Check the length with:
len(mockedMongoServer.AcquireImageLockCalls())
func (*MongoServerMock) Checker ¶
func (mock *MongoServerMock) Checker(ctx context.Context, state *healthcheck.CheckState) error
Checker calls CheckerFunc.
func (*MongoServerMock) CheckerCalls ¶
func (mock *MongoServerMock) CheckerCalls() []struct { Ctx context.Context State *healthcheck.CheckState }
CheckerCalls gets all the calls that were made to Checker. Check the length with:
len(mockedMongoServer.CheckerCalls())
func (*MongoServerMock) Close ¶
func (mock *MongoServerMock) Close(ctx context.Context) error
Close calls CloseFunc.
func (*MongoServerMock) CloseCalls ¶
func (mock *MongoServerMock) CloseCalls() []struct { Ctx context.Context }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedMongoServer.CloseCalls())
func (*MongoServerMock) GetImageCalls ¶
func (mock *MongoServerMock) GetImageCalls() []struct { Ctx context.Context ID string }
GetImageCalls gets all the calls that were made to GetImage. Check the length with:
len(mockedMongoServer.GetImageCalls())
func (*MongoServerMock) GetImages ¶
func (mock *MongoServerMock) GetImages(ctx context.Context, collectionID string) ([]models.Image, error)
GetImages calls GetImagesFunc.
func (*MongoServerMock) GetImagesCalls ¶
func (mock *MongoServerMock) GetImagesCalls() []struct { Ctx context.Context CollectionID string }
GetImagesCalls gets all the calls that were made to GetImages. Check the length with:
len(mockedMongoServer.GetImagesCalls())
func (*MongoServerMock) UnlockImage ¶ added in v0.8.0
func (mock *MongoServerMock) UnlockImage(lockID string) error
UnlockImage calls UnlockImageFunc.
func (*MongoServerMock) UnlockImageCalls ¶ added in v0.8.0
func (mock *MongoServerMock) UnlockImageCalls() []struct { LockID string }
UnlockImageCalls gets all the calls that were made to UnlockImage. Check the length with:
len(mockedMongoServer.UnlockImageCalls())
func (*MongoServerMock) UpdateImage ¶
func (mock *MongoServerMock) UpdateImage(ctx context.Context, id string, image *models.Image) (bool, error)
UpdateImage calls UpdateImageFunc.
func (*MongoServerMock) UpdateImageCalls ¶
func (mock *MongoServerMock) UpdateImageCalls() []struct { Ctx context.Context ID string Image *models.Image }
UpdateImageCalls gets all the calls that were made to UpdateImage. Check the length with:
len(mockedMongoServer.UpdateImageCalls())
func (*MongoServerMock) UpsertImage ¶
UpsertImage calls UpsertImageFunc.
func (*MongoServerMock) UpsertImageCalls ¶
func (mock *MongoServerMock) UpsertImageCalls() []struct { Ctx context.Context ID string Image *models.Image }
UpsertImageCalls gets all the calls that were made to UpsertImage. Check the length with:
len(mockedMongoServer.UpsertImageCalls())