mock

package
v0.0.0-...-0b5e5c0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

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) 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, 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