github.com/diggerhq/digger/libs@v0.0.0-20240604170430-9d61cdf01cc5/orchestrator/mock.go (about)

     1  package orchestrator
     2  
     3  type MockGithubPullrequestManager struct {
     4  	commands []string
     5  }
     6  
     7  func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetUserTeams(organisation string, user string) ([]string, error) {
     8  	return []string{}, nil
     9  }
    10  
    11  func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetChangedFiles(prNumber int) ([]string, error) {
    12  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "GetChangedFiles")
    13  	return nil, nil
    14  }
    15  
    16  func (mockGithubPullrequestManager *MockGithubPullrequestManager) PublishComment(prNumber int, comment string) (*Comment, error) {
    17  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "PublishComment")
    18  	return nil, nil
    19  }
    20  
    21  func (mockGithubPullrequestManager *MockGithubPullrequestManager) ListIssues() ([]*Issue, error) {
    22  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "ListIssues")
    23  	return nil, nil
    24  }
    25  
    26  func (mockGithubPullrequestManager *MockGithubPullrequestManager) PublishIssue(title string, body string) (int64, error) {
    27  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "PublishIssue")
    28  	return 0, nil
    29  }
    30  
    31  func (mockGithubPullrequestManager *MockGithubPullrequestManager) SetStatus(prNumber int, status string, statusContext string) error {
    32  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "SetStatus")
    33  	return nil
    34  }
    35  
    36  func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetCombinedPullRequestStatus(prNumber int) (string, error) {
    37  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "GetCombinedPullRequestStatus")
    38  	return "", nil
    39  }
    40  
    41  func (mockGithubPullrequestManager *MockGithubPullrequestManager) MergePullRequest(prNumber int) error {
    42  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "MergePullRequest")
    43  	return nil
    44  }
    45  
    46  func (mockGithubPullrequestManager *MockGithubPullrequestManager) IsMergeable(prNumber int) (bool, error) {
    47  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "IsMergeable")
    48  	return true, nil
    49  }
    50  
    51  func (mockGithubPullrequestManager *MockGithubPullrequestManager) DownloadLatestPlans(prNumber int) (string, error) {
    52  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "DownloadLatestPlans")
    53  	return "", nil
    54  }
    55  
    56  func (mockGithubPullrequestManager *MockGithubPullrequestManager) IsClosed(prNumber int) (bool, error) {
    57  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "IsClosed")
    58  	return false, nil
    59  }
    60  
    61  func (mockGithubPullrequestManager *MockGithubPullrequestManager) IsMerged(prNumber int) (bool, error) {
    62  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "IsClosed")
    63  	return false, nil
    64  }
    65  
    66  func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetComments(prNumber int) ([]Comment, error) {
    67  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "GetComments")
    68  	return []Comment{}, nil
    69  }
    70  
    71  func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetApprovals(prNumber int) ([]string, error) {
    72  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "GetApprovals")
    73  	return []string{}, nil
    74  }
    75  
    76  func (mockGithubPullrequestManager *MockGithubPullrequestManager) EditComment(prNumber int, commentId interface{}, comment string) error {
    77  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "EditComment")
    78  	return nil
    79  }
    80  
    81  func (mockGithubPullrequestManager *MockGithubPullrequestManager) CreateCommentReaction(id interface{}, reaction string) error {
    82  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "CreateCommentReaction")
    83  	return nil
    84  }
    85  
    86  func (mockGithubPullrequestManager *MockGithubPullrequestManager) GetBranchName(prNumber int) (string, string, error) {
    87  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "GetBranchName")
    88  	return "", "", nil
    89  }
    90  
    91  func (mockGithubPullrequestManager MockGithubPullrequestManager) SetOutput(prNumber int, key string, value string) error {
    92  	mockGithubPullrequestManager.commands = append(mockGithubPullrequestManager.commands, "SetOutput")
    93  	return nil
    94  }