fake

package
v0.0.793 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 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 SCMClient

type SCMClient 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 }
}

SCMClient is like client, but fake.

func (*SCMClient) AddLabel

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

AddLabel adds a label

func (*SCMClient) AssignIssue

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

AssignIssue adds assignees.

func (*SCMClient) BotName

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

BotName returns authenticated login.

func (*SCMClient) ClearMilestone

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

ClearMilestone removes the milestone

func (*SCMClient) CreateComment

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

CreateComment adds a comment to a PR

func (*SCMClient) CreateCommentReaction

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

CreateCommentReaction adds emoji to a comment.

func (*SCMClient) CreateIssueReaction

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

CreateIssueReaction adds an emoji to an issue.

func (*SCMClient) CreateReview

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

CreateReview adds a review to a PR

func (*SCMClient) CreateStatus

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

CreateStatus adds a status context to a commit.

func (*SCMClient) DeleteComment

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

DeleteComment deletes a comment.

func (*SCMClient) DeleteRef

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

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

func (*SCMClient) DeleteStaleComments

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

DeleteStaleComments deletes comments flagged by isStale.

func (*SCMClient) FindIssues

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

FindIssues returns f.Issues

func (*SCMClient) GetCombinedStatus

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

GetCombinedStatus returns the overall status for a commit.

func (*SCMClient) GetFile

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

GetFile returns the bytes of the file.

func (*SCMClient) GetIssueLabels

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

GetIssueLabels gets labels on an issue

func (*SCMClient) GetPullRequest

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

GetPullRequest returns details about the PR.

func (*SCMClient) GetPullRequestChanges

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

GetPullRequestChanges returns the file modifications in a PR.

func (*SCMClient) GetRef

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

GetRef returns the hash of a ref.

func (*SCMClient) GetRepoLabels

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

GetRepoLabels gets labels in a repo.

func (*SCMClient) GetSingleCommit

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

GetSingleCommit returns a single commit.

func (*SCMClient) IsCollaborator

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

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

func (*SCMClient) IsMember

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

IsMember returns true if user is in org.

func (*SCMClient) ListCollaborators

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

ListCollaborators lists the collaborators.

func (*SCMClient) ListIssueComments

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

ListIssueComments returns comments.

func (*SCMClient) ListIssueEvents

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

ListIssueEvents returns issue events

func (*SCMClient) ListMilestones

func (f *SCMClient) ListMilestones(org, repo string) ([]scmprovider.Milestone, error)

ListMilestones lists milestones.

func (*SCMClient) ListOrgMembers added in v0.0.546

func (f *SCMClient) ListOrgMembers(org string) ([]*scm.TeamMember, error)

ListOrgMembers returns an empty list for now

func (*SCMClient) ListPRCommits

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

ListPRCommits lists commits for a given PR.

func (*SCMClient) ListPullRequestComments

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

ListPullRequestComments returns review comments.

func (*SCMClient) ListReviews

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

ListReviews returns reviews.

func (*SCMClient) ListStatuses

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

ListStatuses returns individual status contexts on a commit.

func (*SCMClient) ListTeamMembers

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

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

func (*SCMClient) ListTeams

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

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

func (*SCMClient) PRRefFmt added in v0.0.707

func (f *SCMClient) PRRefFmt() string

PRRefFmt returns the PR ref format for the provider

func (*SCMClient) ProviderType added in v0.0.575

func (f *SCMClient) ProviderType() string

ProviderType returns the provider type

func (*SCMClient) QuoteAuthorForComment added in v0.0.632

func (f *SCMClient) QuoteAuthorForComment(author string) string

QuoteAuthorForComment adds quotes around the author for @ usage if needed

func (*SCMClient) RemoveLabel

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

RemoveLabel removes a label

func (*SCMClient) SetMilestone

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

SetMilestone sets the milestone.

func (*SCMClient) SupportsGraphQL added in v0.0.575

func (f *SCMClient) SupportsGraphQL() bool

SupportsGraphQL returns whether the provider supports GraphQL

Jump to

Keyboard shortcuts

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