Documentation
¶
Overview ¶
Package mocks provides mock implementations for testing.
Index ¶
- type DisplayMessage
- type GitHubAPIClient
- func (m *GitHubAPIClient) CreatePullRequest(head, base, title, body string, assignees, reviewers, labels []string) (*github.PullRequest, error)
- func (m *GitHubAPIClient) DeleteBranch(branch string) error
- func (m *GitHubAPIClient) GetCallCount(method string) int
- func (m *GitHubAPIClient) GetCalls() []MethodCall
- func (m *GitHubAPIClient) GetLastCall(method string) *MethodCall
- func (m *GitHubAPIClient) GetPullRequestByBranch(head, base string) (*github.PullRequest, error)
- func (m *GitHubAPIClient) GetPullRequestsByHead(head string) ([]*github.PullRequest, error)
- func (m *GitHubAPIClient) ListLabels() ([]*ghpkg.Label, error)
- func (m *GitHubAPIClient) MergePullRequest(prNumber int, mergeMethod, commitTitle string) error
- func (m *GitHubAPIClient) Reset()
- func (m *GitHubAPIClient) SetRepositoryFromURL(url string) error
- func (m *GitHubAPIClient) WaitForWorkflows(timeout time.Duration) (string, error)
- type GitLabAPIClient
- func (m *GitLabAPIClient) ApproveMergeRequest(mrIID int64) error
- func (m *GitLabAPIClient) CreateMergeRequest(sourceBranch, targetBranch, title, description, assignee, reviewer string, ...) (*gitlab.MergeRequest, error)
- func (m *GitLabAPIClient) GetCallCount(method string) int
- func (m *GitLabAPIClient) GetCalls() []MethodCall
- func (m *GitLabAPIClient) GetLastCall(method string) *MethodCall
- func (m *GitLabAPIClient) GetMergeRequestByBranch(sourceBranch, targetBranch string) (*gitlab.MergeRequest, error)
- func (m *GitLabAPIClient) GetMergeRequestsByBranch(sourceBranch string) ([]*gitlab.BasicMergeRequest, error)
- func (m *GitLabAPIClient) ListLabels() ([]*glpkg.Label, error)
- func (m *GitLabAPIClient) MergeMergeRequest(mrIID int64, squash bool, commitTitle string) error
- func (m *GitLabAPIClient) Reset()
- func (m *GitLabAPIClient) SetProjectFromURL(url string) error
- func (m *GitLabAPIClient) WaitForPipeline(timeout time.Duration) (string, error)
- type MethodCall
- type MockCommitRetriever
- type MockDisplayRenderer
- func (m *MockDisplayRenderer) Debug(message string)
- func (m *MockDisplayRenderer) DecreasePadding()
- func (m *MockDisplayRenderer) Error(message string)
- func (m *MockDisplayRenderer) GetMessages() []DisplayMessage
- func (m *MockDisplayRenderer) GetMessagesByLevel(level string) []string
- func (m *MockDisplayRenderer) IncreasePadding()
- func (m *MockDisplayRenderer) Info(message string)
- func (m *MockDisplayRenderer) InfoHandle(message string) *bullets.BulletHandle
- func (m *MockDisplayRenderer) Reset()
- func (m *MockDisplayRenderer) SpinnerCircle(message string) *bullets.Spinner
- func (m *MockDisplayRenderer) String() string
- func (m *MockDisplayRenderer) Success(message string)
- type MockMessageSelector
- type MockSelectionRenderer
- type PlatformProvider
- func (m *PlatformProvider) Approve(mrID int64) error
- func (m *PlatformProvider) Create(params platform.CreateParams) (*platform.MergeRequest, error)
- func (m *PlatformProvider) GetByBranch(sourceBranch, targetBranch string) (*platform.MergeRequest, error)
- func (m *PlatformProvider) GetCallCount(method string) int
- func (m *PlatformProvider) GetCalls() []MethodCall
- func (m *PlatformProvider) GetLastCall(method string) *MethodCall
- func (m *PlatformProvider) Initialize(remoteURL string) error
- func (m *PlatformProvider) ListLabels() ([]platform.Label, error)
- func (m *PlatformProvider) Merge(params platform.MergeParams) error
- func (m *PlatformProvider) PipelineTimeout() string
- func (m *PlatformProvider) PlatformName() string
- func (m *PlatformProvider) Reset()
- func (m *PlatformProvider) WaitForPipeline(timeout time.Duration) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DisplayMessage ¶
DisplayMessage represents a logged message with its level.
type GitHubAPIClient ¶
type GitHubAPIClient struct {
// Configurable responses
SetRepositoryFromURLError error
ListLabelsResponse []*ghpkg.Label
ListLabelsError error
CreatePullRequestResponse *github.PullRequest
CreatePullRequestError error
GetPullRequestByBranchResponse *github.PullRequest
GetPullRequestByBranchError error
WaitForWorkflowsConclusion string
WaitForWorkflowsError error
MergePullRequestError error
GetPullRequestsByHeadResponse []*github.PullRequest
GetPullRequestsByHeadError error
DeleteBranchError error
// contains filtered or unexported fields
}
GitHubAPIClient is a mock implementation of github.APIClient with call tracking.
func NewGitHubAPIClient ¶
func NewGitHubAPIClient() *GitHubAPIClient
NewGitHubAPIClient creates a new mock GitHub API client.
func (*GitHubAPIClient) CreatePullRequest ¶
func (m *GitHubAPIClient) CreatePullRequest( head, base, title, body string, assignees, reviewers, labels []string, ) (*github.PullRequest, error)
CreatePullRequest implements github.APIClient.
func (*GitHubAPIClient) DeleteBranch ¶
func (m *GitHubAPIClient) DeleteBranch(branch string) error
DeleteBranch implements github.APIClient.
func (*GitHubAPIClient) GetCallCount ¶
func (m *GitHubAPIClient) GetCallCount(method string) int
GetCallCount returns the number of times a method was called.
func (*GitHubAPIClient) GetCalls ¶
func (m *GitHubAPIClient) GetCalls() []MethodCall
GetCalls returns all tracked method calls.
func (*GitHubAPIClient) GetLastCall ¶
func (m *GitHubAPIClient) GetLastCall(method string) *MethodCall
GetLastCall returns the last call to the specified method, or nil if not called.
func (*GitHubAPIClient) GetPullRequestByBranch ¶
func (m *GitHubAPIClient) GetPullRequestByBranch(head, base string) (*github.PullRequest, error)
GetPullRequestByBranch implements github.APIClient.
func (*GitHubAPIClient) GetPullRequestsByHead ¶
func (m *GitHubAPIClient) GetPullRequestsByHead(head string) ([]*github.PullRequest, error)
GetPullRequestsByHead implements github.APIClient.
func (*GitHubAPIClient) ListLabels ¶
func (m *GitHubAPIClient) ListLabels() ([]*ghpkg.Label, error)
ListLabels implements github.APIClient.
func (*GitHubAPIClient) MergePullRequest ¶
func (m *GitHubAPIClient) MergePullRequest(prNumber int, mergeMethod, commitTitle string) error
MergePullRequest implements github.APIClient.
func (*GitHubAPIClient) SetRepositoryFromURL ¶
func (m *GitHubAPIClient) SetRepositoryFromURL(url string) error
SetRepositoryFromURL implements github.APIClient.
func (*GitHubAPIClient) WaitForWorkflows ¶
func (m *GitHubAPIClient) WaitForWorkflows(timeout time.Duration) (string, error)
WaitForWorkflows implements github.APIClient.
type GitLabAPIClient ¶
type GitLabAPIClient struct {
// Configurable responses
SetProjectFromURLError error
ListLabelsResponse []*glpkg.Label
ListLabelsError error
CreateMergeRequestResponse *gitlab.MergeRequest
CreateMergeRequestError error
GetMergeRequestByBranchResponse *gitlab.MergeRequest
GetMergeRequestByBranchError error
WaitForPipelineStatus string
WaitForPipelineError error
ApproveMergeRequestError error
MergeMergeRequestError error
GetMergeRequestsByBranchResponse []*gitlab.BasicMergeRequest
GetMergeRequestsByBranchError error
// contains filtered or unexported fields
}
GitLabAPIClient is a mock implementation of gitlab.APIClient with call tracking.
func NewGitLabAPIClient ¶
func NewGitLabAPIClient() *GitLabAPIClient
NewGitLabAPIClient creates a new mock GitLab API client.
func (*GitLabAPIClient) ApproveMergeRequest ¶
func (m *GitLabAPIClient) ApproveMergeRequest(mrIID int64) error
ApproveMergeRequest implements gitlab.APIClient.
func (*GitLabAPIClient) CreateMergeRequest ¶
func (m *GitLabAPIClient) CreateMergeRequest( sourceBranch, targetBranch, title, description, assignee, reviewer string, labels []string, squash bool, ) (*gitlab.MergeRequest, error)
CreateMergeRequest implements gitlab.APIClient.
func (*GitLabAPIClient) GetCallCount ¶
func (m *GitLabAPIClient) GetCallCount(method string) int
GetCallCount returns the number of times a method was called.
func (*GitLabAPIClient) GetCalls ¶
func (m *GitLabAPIClient) GetCalls() []MethodCall
GetCalls returns all tracked method calls.
func (*GitLabAPIClient) GetLastCall ¶
func (m *GitLabAPIClient) GetLastCall(method string) *MethodCall
GetLastCall returns the last call to the specified method, or nil if not called.
func (*GitLabAPIClient) GetMergeRequestByBranch ¶
func (m *GitLabAPIClient) GetMergeRequestByBranch(sourceBranch, targetBranch string) (*gitlab.MergeRequest, error)
GetMergeRequestByBranch implements gitlab.APIClient.
func (*GitLabAPIClient) GetMergeRequestsByBranch ¶
func (m *GitLabAPIClient) GetMergeRequestsByBranch(sourceBranch string) ([]*gitlab.BasicMergeRequest, error)
GetMergeRequestsByBranch implements gitlab.APIClient.
func (*GitLabAPIClient) ListLabels ¶
func (m *GitLabAPIClient) ListLabels() ([]*glpkg.Label, error)
ListLabels implements gitlab.APIClient.
func (*GitLabAPIClient) MergeMergeRequest ¶
func (m *GitLabAPIClient) MergeMergeRequest(mrIID int64, squash bool, commitTitle string) error
MergeMergeRequest implements gitlab.APIClient.
func (*GitLabAPIClient) SetProjectFromURL ¶
func (m *GitLabAPIClient) SetProjectFromURL(url string) error
SetProjectFromURL implements gitlab.APIClient.
func (*GitLabAPIClient) WaitForPipeline ¶
func (m *GitLabAPIClient) WaitForPipeline(timeout time.Duration) (string, error)
WaitForPipeline implements gitlab.APIClient.
type MethodCall ¶
MethodCall represents a tracked method call with its parameters.
type MockCommitRetriever ¶ added in v0.6.0
type MockCommitRetriever struct {
GetCommitsResponse []commits.Commit
GetCommitsError error
CallHistory []string
CallCount map[string]int
}
MockCommitRetriever is a mock implementation of commits.CommitRetriever for testing.
func NewMockCommitRetriever ¶ added in v0.6.0
func NewMockCommitRetriever() *MockCommitRetriever
NewMockCommitRetriever creates a new mock commit retriever.
func (*MockCommitRetriever) GetCallCountFor ¶ added in v0.6.0
func (m *MockCommitRetriever) GetCallCountFor(method string) int
GetCallCountFor returns the number of times a method was called.
func (*MockCommitRetriever) GetCommits ¶ added in v0.6.0
func (m *MockCommitRetriever) GetCommits(branch string) ([]commits.Commit, error)
GetCommits implements commits.CommitRetriever interface.
func (*MockCommitRetriever) GetLastCall ¶ added in v0.6.0
func (m *MockCommitRetriever) GetLastCall() string
GetLastCall returns the last method call recorded.
type MockDisplayRenderer ¶
type MockDisplayRenderer struct {
// contains filtered or unexported fields
}
MockDisplayRenderer is a mock implementation of DisplayRenderer for testing.
func NewMockDisplayRenderer ¶
func NewMockDisplayRenderer() *MockDisplayRenderer
NewMockDisplayRenderer creates a new mock display renderer.
func (*MockDisplayRenderer) Debug ¶
func (m *MockDisplayRenderer) Debug(message string)
Debug implements DisplayRenderer.
func (*MockDisplayRenderer) DecreasePadding ¶
func (m *MockDisplayRenderer) DecreasePadding()
DecreasePadding implements DisplayRenderer.
func (*MockDisplayRenderer) Error ¶
func (m *MockDisplayRenderer) Error(message string)
Error implements DisplayRenderer.
func (*MockDisplayRenderer) GetMessages ¶
func (m *MockDisplayRenderer) GetMessages() []DisplayMessage
GetMessages returns all tracked messages.
func (*MockDisplayRenderer) GetMessagesByLevel ¶
func (m *MockDisplayRenderer) GetMessagesByLevel(level string) []string
GetMessagesByLevel returns all messages of a specific level.
func (*MockDisplayRenderer) IncreasePadding ¶
func (m *MockDisplayRenderer) IncreasePadding()
IncreasePadding implements DisplayRenderer.
func (*MockDisplayRenderer) Info ¶
func (m *MockDisplayRenderer) Info(message string)
Info implements DisplayRenderer.
func (*MockDisplayRenderer) InfoHandle ¶
func (m *MockDisplayRenderer) InfoHandle(message string) *bullets.BulletHandle
InfoHandle implements DisplayRenderer.
func (*MockDisplayRenderer) Reset ¶
func (m *MockDisplayRenderer) Reset()
Reset clears all tracked messages.
func (*MockDisplayRenderer) SpinnerCircle ¶
func (m *MockDisplayRenderer) SpinnerCircle(message string) *bullets.Spinner
SpinnerCircle implements DisplayRenderer.
func (*MockDisplayRenderer) String ¶
func (m *MockDisplayRenderer) String() string
String returns a formatted representation of all messages for debugging.
func (*MockDisplayRenderer) Success ¶
func (m *MockDisplayRenderer) Success(message string)
Success implements DisplayRenderer.
type MockMessageSelector ¶ added in v0.6.0
type MockMessageSelector struct {
GetMessageForMRResponse commits.MessageSelection
GetMessageForMRError error
CallHistory []string
CallCount map[string]int
}
MockMessageSelector is a mock implementation of commits.MessageSelector for testing.
func NewMockMessageSelector ¶ added in v0.6.0
func NewMockMessageSelector() *MockMessageSelector
NewMockMessageSelector creates a new mock message selector.
func (*MockMessageSelector) GetCallCountFor ¶ added in v0.6.0
func (m *MockMessageSelector) GetCallCountFor(method string) int
GetCallCountFor returns the number of times a method was called.
func (*MockMessageSelector) GetLastCall ¶ added in v0.6.0
func (m *MockMessageSelector) GetLastCall() string
GetLastCall returns the last method call recorded.
func (*MockMessageSelector) GetMessageForMR ¶ added in v0.6.0
func (m *MockMessageSelector) GetMessageForMR(_ []commits.Commit, _ string) (commits.MessageSelection, error)
GetMessageForMR implements commits.MessageSelector interface.
type MockSelectionRenderer ¶ added in v0.6.0
type MockSelectionRenderer struct {
DisplaySelectionPromptResponse int
DisplaySelectionPromptError error
CallHistory []string
CallCount map[string]int
}
MockSelectionRenderer is a mock implementation of commits.SelectionRenderer for testing.
func NewMockSelectionRenderer ¶ added in v0.6.0
func NewMockSelectionRenderer() *MockSelectionRenderer
NewMockSelectionRenderer creates a new mock selection renderer.
func (*MockSelectionRenderer) DisplaySelectionPrompt ¶ added in v0.6.0
func (m *MockSelectionRenderer) DisplaySelectionPrompt(_ []commits.Commit) (int, error)
DisplaySelectionPrompt implements commits.SelectionRenderer interface.
func (*MockSelectionRenderer) GetCallCountFor ¶ added in v0.6.0
func (m *MockSelectionRenderer) GetCallCountFor(method string) int
GetCallCountFor returns the number of times a method was called.
func (*MockSelectionRenderer) GetLastCall ¶ added in v0.6.0
func (m *MockSelectionRenderer) GetLastCall() string
GetLastCall returns the last method call recorded.
type PlatformProvider ¶ added in v0.11.0
type PlatformProvider struct {
// Configurable responses
InitializeError error
ListLabelsResponse []platform.Label
ListLabelsError error
CreateResponse *platform.MergeRequest
CreateError error
GetByBranchResponse *platform.MergeRequest
GetByBranchError error
WaitForPipelineStatus string
WaitForPipelineError error
ApproveError error
MergeError error
PlatformNameValue string
PipelineTimeoutValue string
// contains filtered or unexported fields
}
PlatformProvider is a mock implementation of platform.Provider with call tracking.
func NewPlatformProvider ¶ added in v0.11.0
func NewPlatformProvider() *PlatformProvider
NewPlatformProvider creates a new mock platform provider.
func (*PlatformProvider) Approve ¶ added in v0.11.0
func (m *PlatformProvider) Approve(mrID int64) error
Approve implements platform.Provider.
func (*PlatformProvider) Create ¶ added in v0.11.0
func (m *PlatformProvider) Create(params platform.CreateParams) (*platform.MergeRequest, error)
Create implements platform.Provider.
func (*PlatformProvider) GetByBranch ¶ added in v0.11.0
func (m *PlatformProvider) GetByBranch(sourceBranch, targetBranch string) (*platform.MergeRequest, error)
GetByBranch implements platform.Provider.
func (*PlatformProvider) GetCallCount ¶ added in v0.11.0
func (m *PlatformProvider) GetCallCount(method string) int
GetCallCount returns the number of times a method was called.
func (*PlatformProvider) GetCalls ¶ added in v0.11.0
func (m *PlatformProvider) GetCalls() []MethodCall
GetCalls returns all tracked method calls.
func (*PlatformProvider) GetLastCall ¶ added in v0.11.0
func (m *PlatformProvider) GetLastCall(method string) *MethodCall
GetLastCall returns the last call to the specified method, or nil if not called.
func (*PlatformProvider) Initialize ¶ added in v0.11.0
func (m *PlatformProvider) Initialize(remoteURL string) error
Initialize implements platform.Provider.
func (*PlatformProvider) ListLabels ¶ added in v0.11.0
func (m *PlatformProvider) ListLabels() ([]platform.Label, error)
ListLabels implements platform.Provider.
func (*PlatformProvider) Merge ¶ added in v0.11.0
func (m *PlatformProvider) Merge(params platform.MergeParams) error
Merge implements platform.Provider.
func (*PlatformProvider) PipelineTimeout ¶ added in v0.11.0
func (m *PlatformProvider) PipelineTimeout() string
PipelineTimeout implements platform.Provider.
func (*PlatformProvider) PlatformName ¶ added in v0.11.0
func (m *PlatformProvider) PlatformName() string
PlatformName implements platform.Provider.
func (*PlatformProvider) Reset ¶ added in v0.11.0
func (m *PlatformProvider) Reset()
Reset clears all tracked calls.
func (*PlatformProvider) WaitForPipeline ¶ added in v0.11.0
func (m *PlatformProvider) WaitForPipeline(timeout time.Duration) (string, error)
WaitForPipeline implements platform.Provider.