mocks

package
v0.0.0-...-2267940 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2025 License: Apache-2.0, MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitRemoteInteractorMock

type GitRemoteInteractorMock struct {
	// CloneFunc mocks the Clone method.
	CloneFunc func(s storage.Storer, worktree billy.Filesystem, o *git.CloneOptions) (*git.Repository, error)

	// FetchFunc mocks the Fetch method.
	FetchFunc func(repo *git.Repository, o *git.FetchOptions) error

	// PullFunc mocks the Pull method.
	PullFunc func(repo *git.Repository, o *git.PullOptions) error

	// PushFunc mocks the Push method.
	PushFunc func(repo *git.Repository, o *git.PushOptions) error
	// contains filtered or unexported fields
}

GitRemoteInteractorMock is a mock implementation of remote.GitRemoteInteractor.

func TestSomethingThatUsesGitRemoteInteractor(t *testing.T) {

	// make and configure a mocked remote.GitRemoteInteractor
	mockedGitRemoteInteractor := &GitRemoteInteractorMock{
		CloneFunc: func(s storage.Storer, worktree billy.Filesystem, o *git.CloneOptions) (*git.Repository, error) {
			panic("mock out the Clone method")
		},
		FetchFunc: func(repo *git.Repository, o *git.FetchOptions) error {
			panic("mock out the Fetch method")
		},
		PullFunc: func(repo *git.Repository, o *git.PullOptions) error {
			panic("mock out the Pull method")
		},
		PushFunc: func(repo *git.Repository, o *git.PushOptions) error {
			panic("mock out the Push method")
		},
	}

	// use mockedGitRemoteInteractor in code that requires remote.GitRemoteInteractor
	// and then make assertions.

}

func (*GitRemoteInteractorMock) Clone

func (mock *GitRemoteInteractorMock) Clone(s storage.Storer, worktree billy.Filesystem, o *git.CloneOptions) (*git.Repository, error)

Clone calls CloneFunc.

func (*GitRemoteInteractorMock) CloneCalls

func (mock *GitRemoteInteractorMock) CloneCalls() []struct {
	S        storage.Storer
	Worktree billy.Filesystem
	O        *git.CloneOptions
}

CloneCalls gets all the calls that were made to Clone. Check the length with:

len(mockedGitRemoteInteractor.CloneCalls())

func (*GitRemoteInteractorMock) Fetch

func (mock *GitRemoteInteractorMock) Fetch(repo *git.Repository, o *git.FetchOptions) error

Fetch calls FetchFunc.

func (*GitRemoteInteractorMock) FetchCalls

func (mock *GitRemoteInteractorMock) FetchCalls() []struct {
	Repo *git.Repository
	O    *git.FetchOptions
}

FetchCalls gets all the calls that were made to Fetch. Check the length with:

len(mockedGitRemoteInteractor.FetchCalls())

func (*GitRemoteInteractorMock) Pull

func (mock *GitRemoteInteractorMock) Pull(repo *git.Repository, o *git.PullOptions) error

Pull calls PullFunc.

func (*GitRemoteInteractorMock) PullCalls

func (mock *GitRemoteInteractorMock) PullCalls() []struct {
	Repo *git.Repository
	O    *git.PullOptions
}

PullCalls gets all the calls that were made to Pull. Check the length with:

len(mockedGitRemoteInteractor.PullCalls())

func (*GitRemoteInteractorMock) Push

func (mock *GitRemoteInteractorMock) Push(repo *git.Repository, o *git.PushOptions) error

Push calls PushFunc.

func (*GitRemoteInteractorMock) PushCalls

func (mock *GitRemoteInteractorMock) PushCalls() []struct {
	Repo *git.Repository
	O    *git.PushOptions
}

PushCalls gets all the calls that were made to Push. Check the length with:

len(mockedGitRemoteInteractor.PushCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL