Documentation ¶
Index ¶
- type MockClient
- func (m *MockClient) AddBranchHead(repo, branch, sha string)
- func (m *MockClient) AddFileContents(repo, path, ref string, body []byte)
- func (m *MockClient) AssertBranchCreated(repo, branch, sha string)
- func (m *MockClient) AssertNoBranchesCreated()
- func (m *MockClient) AssertNoInteractions()
- func (m *MockClient) AssertNoPullRequestsCreated()
- func (m *MockClient) AssertPullRequestCreated(repo string, inp *scm.PullRequestInput)
- func (m *MockClient) CreateBranch(ctx context.Context, repo, branch, sha string) error
- func (m *MockClient) CreatePullRequest(ctx context.Context, repo string, inp *scm.PullRequestInput) (*scm.PullRequest, error)
- func (m *MockClient) GetBranchHead(ctx context.Context, repo, branch string) (string, error)
- func (m *MockClient) GetFile(ctx context.Context, repo, ref, path string) (*scm.Content, error)
- func (m *MockClient) GetUpdatedContents(repo, path, ref string) []byte
- func (m *MockClient) RefuteBranchCreated(repo, branch, sha string)
- func (m *MockClient) RefutePullRequestCreated(repo string, inp *scm.PullRequestInput)
- func (m *MockClient) UpdateFile(ctx context.Context, repo, branch, path, message, previousSHA string, ...) error
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 (*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 ¶
GetBranchHead 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.