Documentation
¶
Index ¶
- type StorerMock
- func (mock *StorerMock) Commit(req git.CommitRequest) error
- func (mock *StorerMock) CommitCalls() []struct{ ... }
- func (mock *StorerMock) Delete(key string, author git.Author) error
- func (mock *StorerMock) DeleteCalls() []struct{ ... }
- func (mock *StorerMock) GetRevision(key string, rev string) ([]byte, string, error)
- func (mock *StorerMock) GetRevisionCalls() []struct{ ... }
- func (mock *StorerMock) History(key string, limit int) ([]git.HistoryEntry, error)
- func (mock *StorerMock) HistoryCalls() []struct{ ... }
- func (mock *StorerMock) Pull() error
- func (mock *StorerMock) PullCalls() []struct{}
- func (mock *StorerMock) Push() error
- func (mock *StorerMock) PushCalls() []struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StorerMock ¶
type StorerMock struct {
// CommitFunc mocks the Commit method.
CommitFunc func(req git.CommitRequest) error
// DeleteFunc mocks the Delete method.
DeleteFunc func(key string, author git.Author) error
// GetRevisionFunc mocks the GetRevision method.
GetRevisionFunc func(key string, rev string) ([]byte, string, error)
// HistoryFunc mocks the History method.
HistoryFunc func(key string, limit int) ([]git.HistoryEntry, error)
// PullFunc mocks the Pull method.
PullFunc func() error
// PushFunc mocks the Push method.
PushFunc func() error
// contains filtered or unexported fields
}
StorerMock is a mock implementation of git.Storer.
func TestSomethingThatUsesStorer(t *testing.T) {
// make and configure a mocked git.Storer
mockedStorer := &StorerMock{
CommitFunc: func(req git.CommitRequest) error {
panic("mock out the Commit method")
},
DeleteFunc: func(key string, author git.Author) error {
panic("mock out the Delete method")
},
GetRevisionFunc: func(key string, rev string) ([]byte, string, error) {
panic("mock out the GetRevision method")
},
HistoryFunc: func(key string, limit int) ([]git.HistoryEntry, error) {
panic("mock out the History method")
},
PullFunc: func() error {
panic("mock out the Pull method")
},
PushFunc: func() error {
panic("mock out the Push method")
},
}
// use mockedStorer in code that requires git.Storer
// and then make assertions.
}
func (*StorerMock) Commit ¶
func (mock *StorerMock) Commit(req git.CommitRequest) error
Commit calls CommitFunc.
func (*StorerMock) CommitCalls ¶
func (mock *StorerMock) CommitCalls() []struct { Req git.CommitRequest }
CommitCalls gets all the calls that were made to Commit. Check the length with:
len(mockedStorer.CommitCalls())
func (*StorerMock) Delete ¶
func (mock *StorerMock) Delete(key string, author git.Author) error
Delete calls DeleteFunc.
func (*StorerMock) DeleteCalls ¶
func (mock *StorerMock) DeleteCalls() []struct { Key string Author git.Author }
DeleteCalls gets all the calls that were made to Delete. Check the length with:
len(mockedStorer.DeleteCalls())
func (*StorerMock) GetRevision ¶ added in v0.12.0
GetRevision calls GetRevisionFunc.
func (*StorerMock) GetRevisionCalls ¶ added in v0.12.0
func (mock *StorerMock) GetRevisionCalls() []struct { Key string Rev string }
GetRevisionCalls gets all the calls that were made to GetRevision. Check the length with:
len(mockedStorer.GetRevisionCalls())
func (*StorerMock) History ¶ added in v0.12.0
func (mock *StorerMock) History(key string, limit int) ([]git.HistoryEntry, error)
History calls HistoryFunc.
func (*StorerMock) HistoryCalls ¶ added in v0.12.0
func (mock *StorerMock) HistoryCalls() []struct { Key string Limit int }
HistoryCalls gets all the calls that were made to History. Check the length with:
len(mockedStorer.HistoryCalls())
func (*StorerMock) PullCalls ¶
func (mock *StorerMock) PullCalls() []struct { }
PullCalls gets all the calls that were made to Pull. Check the length with:
len(mockedStorer.PullCalls())
func (*StorerMock) PushCalls ¶
func (mock *StorerMock) PushCalls() []struct { }
PushCalls gets all the calls that were made to Push. Check the length with:
len(mockedStorer.PushCalls())