mock

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockClient

type MockClient struct {
	GetFileErr error

	UpdateFileErr error

	CreateBranchErr error

	CreatePullRequestErr error
	// contains filtered or unexported fields
}

MockClient implements the client.GitClient interface with an in-memory representation of files.

func New

func New(t *testing.T) *MockClient

New creates and returns a new MockClient.

func (*MockClient) AddBranchHead

func (m *MockClient) AddBranchHead(repo, branch, sha string)

AddBranchHead is a mock for setting up a response for GetBranchHead.

func (*MockClient) AddFileContents

func (m *MockClient) AddFileContents(repo, path, ref string, body []byte)

AddFileContents is a mock method for setting up a fixture for GetFileContents.

func (*MockClient) AssertBranchCreated

func (m *MockClient) AssertBranchCreated(repo, branch, sha string)

AssertBranchCreated fails if no matching branch was created using CreateBranch.

func (*MockClient) AssertNoBranchesCreated

func (m *MockClient) AssertNoBranchesCreated()

AssertNoBranchesCreated fails if a branch was created.

func (*MockClient) AssertNoInteractions

func (m *MockClient) AssertNoInteractions()

AssertNoInteractions fails if any git request was made.

func (*MockClient) AssertNoPullRequestsCreated

func (m *MockClient) AssertNoPullRequestsCreated()

AssertNoPullRequestsCreated fails if a PR was created.

func (*MockClient) AssertPullRequestCreated

func (m *MockClient) AssertPullRequestCreated(repo string, inp *scm.PullRequestInput)

AssertPullRequestCreated fails if no matching PullRequest was created.

func (*MockClient) CreateBranch

func (m *MockClient) CreateBranch(ctx context.Context, repo, branch, sha string) error

CreateBranch implements the client.GitClient interface.

func (*MockClient) CreatePullRequest

func (m *MockClient) CreatePullRequest(ctx context.Context, repo string, inp *scm.PullRequestInput) (*scm.PullRequest, error)

CreatePullRequest implements the client.GitClient interface.

func (*MockClient) DeleteFile

func (c *MockClient) DeleteFile(ctx context.Context, repo, branch, path, message, previousSHA string, signature scm.Signature, content []byte) error

DeleteFile is here for future ref

func (*MockClient) GetBranchHead

func (m *MockClient) GetBranchHead(ctx context.Context, repo, branch string) (string, error)

GetBranchHead implements the client.GitClient interface.

func (*MockClient) GetFile

func (m *MockClient) GetFile(ctx context.Context, repo, ref, path string) (*scm.Content, error)

GetFile implements the client.GitClient interface.

func (*MockClient) GetUpdatedContents

func (m *MockClient) GetUpdatedContents(repo, path, ref string) []byte

GetUpdatedContents returns the bytes captured by the mock implementation for UpdateFile.

func (*MockClient) RefuteBranchCreated

func (m *MockClient) RefuteBranchCreated(repo, branch, sha string)

RefuteBranchCreated fails if a matching branch was created using CreateBranch.

func (*MockClient) RefutePullRequestCreated

func (m *MockClient) RefutePullRequestCreated(repo string, inp *scm.PullRequestInput)

RefutePullRequestCreated fails if matching PullRequest was created.

func (*MockClient) UpdateFile

func (m *MockClient) UpdateFile(ctx context.Context, repo, branch, path, message, previousSHA string, signature scm.Signature, content []byte) error

UpdateFile implements the client.GitClient interface.

Jump to

Keyboard shortcuts

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