fakegitprovider

package
v0.0.424 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Bot is the exported botName
	Bot = botName
	// TestRef is the ref returned when calling GetRef
	TestRef = "abcde"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeClient

type FakeClient struct {
	Issues              map[int][]*scm.Issue
	OrgMembers          map[string][]string
	Collaborators       []string
	IssueComments       map[int][]*scm.Comment
	IssueCommentID      int
	PullRequests        map[int]*scm.PullRequest
	PullRequestChanges  map[int][]*scm.Change
	PullRequestComments map[int][]*scm.Comment
	ReviewID            int
	Reviews             map[int][]*scm.Review
	CombinedStatuses    map[string]*scm.CombinedStatus
	CreatedStatuses     map[string][]*scm.StatusInput
	IssueEvents         map[int][]*scm.ListedIssueEvent
	Commits             map[string]*scm.Commit

	//All Labels That Exist In The Repo
	RepoLabelsExisting []string
	// org/repo#number:label
	IssueLabelsAdded          []string
	IssueLabelsExisting       []string
	IssueLabelsRemoved        []string
	PullRequestLabelsAdded    []string
	PullRequestLabelsExisting []string
	PullRequestLabelsRemoved  []string

	// org/repo#number:body
	IssueCommentsAdded       []string
	PullRequestCommentsAdded []string
	// org/repo#issuecommentid
	IssueCommentsDeleted       []string
	PullRequestCommentsDeleted []string

	// org/repo#issuecommentid:reaction
	IssueReactionsAdded   []string
	CommentReactionsAdded []string

	// org/repo#number:assignee
	AssigneesAdded []string

	// org/repo#number:milestone (represents the milestone for a specific issue)
	Milestone    int
	MilestoneMap map[string]int

	// list of commits for each PR
	// org/repo#number:[]commit
	CommitMap map[string][]scm.Commit

	// Fake remote git storage. File name are keys
	// and values map SHA to content
	RemoteFiles map[string]map[string]string

	// A list of refs that got deleted via DeleteRef
	RefsDeleted []struct{ Org, Repo, Ref string }
}

FakeClient is like client, but fake.

func (*FakeClient) AddLabel

func (f *FakeClient) AddLabel(owner, repo string, number int, label string, pr bool) error

AddLabel adds a label

func (*FakeClient) AssignIssue

func (f *FakeClient) AssignIssue(owner, repo string, number int, assignees []string) error

AssignIssue adds assignees.

func (*FakeClient) BotName

func (f *FakeClient) BotName() (string, error)

BotName returns authenticated login.

func (*FakeClient) ClearMilestone

func (f *FakeClient) ClearMilestone(org, repo string, issueNum int) error

ClearMilestone removes the milestone

func (*FakeClient) CreateComment

func (f *FakeClient) CreateComment(owner, repo string, number int, pr bool, comment string) error

CreateComment adds a comment to a PR

func (*FakeClient) CreateCommentReaction

func (f *FakeClient) CreateCommentReaction(org, repo string, ID int, reaction string) error

CreateCommentReaction adds emoji to a comment.

func (*FakeClient) CreateIssueReaction

func (f *FakeClient) CreateIssueReaction(org, repo string, ID int, reaction string) error

CreateIssueReaction adds an emoji to an issue.

func (*FakeClient) CreateReview

func (f *FakeClient) CreateReview(org, repo string, number int, r gitprovider.DraftReview) error

CreateReview adds a review to a PR

func (*FakeClient) CreateStatus

func (f *FakeClient) CreateStatus(owner, repo, SHA string, s *scm.StatusInput) (*scm.Status, error)

CreateStatus adds a status context to a commit.

func (*FakeClient) DeleteComment

func (f *FakeClient) DeleteComment(owner, repo string, number, ID int, pr bool) error

DeleteComment deletes a comment.

func (*FakeClient) DeleteRef

func (f *FakeClient) DeleteRef(owner, repo, ref string) error

DeleteRef returns an error indicating if deletion of the given ref was successful

func (*FakeClient) DeleteStaleComments

func (f *FakeClient) DeleteStaleComments(org, repo string, number int, comments []*scm.Comment, pr bool, isStale func(*scm.Comment) bool) error

DeleteStaleComments deletes comments flagged by isStale.

func (*FakeClient) FindIssues

func (f *FakeClient) FindIssues(query, sort string, asc bool) ([]scm.Issue, error)

FindIssues returns f.Issues

func (*FakeClient) GetCombinedStatus

func (f *FakeClient) GetCombinedStatus(owner, repo, ref string) (*scm.CombinedStatus, error)

GetCombinedStatus returns the overall status for a commit.

func (*FakeClient) GetFile

func (f *FakeClient) GetFile(org, repo, file, commit string) ([]byte, error)

GetFile returns the bytes of the file.

func (*FakeClient) GetIssueLabels

func (f *FakeClient) GetIssueLabels(owner, repo string, number int, pr bool) ([]*scm.Label, error)

GetIssueLabels gets labels on an issue

func (*FakeClient) GetPullRequest

func (f *FakeClient) GetPullRequest(owner, repo string, number int) (*scm.PullRequest, error)

GetPullRequest returns details about the PR.

func (*FakeClient) GetPullRequestChanges

func (f *FakeClient) GetPullRequestChanges(org, repo string, number int) ([]*scm.Change, error)

GetPullRequestChanges returns the file modifications in a PR.

func (*FakeClient) GetRef

func (f *FakeClient) GetRef(owner, repo, ref string) (string, error)

GetRef returns the hash of a ref.

func (*FakeClient) GetRepoLabels

func (f *FakeClient) GetRepoLabels(owner, repo string) ([]*scm.Label, error)

GetRepoLabels gets labels in a repo.

func (*FakeClient) GetSingleCommit

func (f *FakeClient) GetSingleCommit(org, repo, SHA string) (*scm.Commit, error)

GetSingleCommit returns a single commit.

func (*FakeClient) IsCollaborator

func (f *FakeClient) IsCollaborator(org, repo, login string) (bool, error)

IsCollaborator returns true if the user is a collaborator of the repo.

func (*FakeClient) IsMember

func (f *FakeClient) IsMember(org, user string) (bool, error)

IsMember returns true if user is in org.

func (*FakeClient) ListCollaborators

func (f *FakeClient) ListCollaborators(org, repo string) ([]scm.User, error)

ListCollaborators lists the collaborators.

func (*FakeClient) ListIssueComments

func (f *FakeClient) ListIssueComments(owner, repo string, number int) ([]*scm.Comment, error)

ListIssueComments returns comments.

func (*FakeClient) ListIssueEvents

func (f *FakeClient) ListIssueEvents(owner, repo string, number int) ([]*scm.ListedIssueEvent, error)

ListIssueEvents returns issue events

func (*FakeClient) ListMilestones

func (f *FakeClient) ListMilestones(org, repo string) ([]gitprovider.Milestone, error)

ListMilestones lists milestones.

func (*FakeClient) ListPRCommits

func (f *FakeClient) ListPRCommits(org, repo string, prNumber int) ([]scm.Commit, error)

ListPRCommits lists commits for a given PR.

func (*FakeClient) ListPullRequestComments

func (f *FakeClient) ListPullRequestComments(owner, repo string, number int) ([]*scm.Comment, error)

ListPullRequestComments returns review comments.

func (*FakeClient) ListReviews

func (f *FakeClient) ListReviews(owner, repo string, number int) ([]*scm.Review, error)

ListReviews returns reviews.

func (*FakeClient) ListStatuses

func (f *FakeClient) ListStatuses(org, repo, ref string) ([]*scm.Status, error)

ListStatuses returns individual status contexts on a commit.

func (*FakeClient) ListTeamMembers

func (f *FakeClient) ListTeamMembers(teamID int, role string) ([]*scm.TeamMember, error)

ListTeamMembers return a fake team with a single "sig-lead" Github teammember

func (*FakeClient) ListTeams

func (f *FakeClient) ListTeams(org string) ([]*scm.Team, error)

ListTeams return a list of fake teams that correspond to the fake team members returned by ListTeamMembers

func (*FakeClient) RemoveLabel

func (f *FakeClient) RemoveLabel(owner, repo string, number int, label string, pr bool) error

RemoveLabel removes a label

func (*FakeClient) SetMilestone

func (f *FakeClient) SetMilestone(org, repo string, issueNum, milestoneNum int) error

SetMilestone sets the milestone.

Jump to

Keyboard shortcuts

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