fake

package
v1.14.34 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: BSD-3-Clause Imports: 16 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// RoleAll lists both members and admins
	RoleAll = "all"
	// RoleAdmin specifies the user is an org admin, or lists only admins
	RoleAdmin = "admin"
	// RoleMaintainer specifies the user is a team maintainer, or lists only maintainers
	RoleMaintainer = "maintainer"
	// RoleMember specifies the user is a regular user, or only lists regular users
	RoleMember = "member"
	// StatePending specifies the user has an invitation to the org/team.
	StatePending = "pending"
	// StateActive specifies the user's membership is active.
	StateActive = "active"
)
View Source
const (

	// DefaultFileWritePermissions default permissions when creating a file
	DefaultFileWritePermissions = 0o644
)

Variables

View Source
var NormLogin = strings.ToLower

NormLogin normalizes login strings

Functions

func AssertNoRepoExists added in v1.6.18

func AssertNoRepoExists(ctx context.Context, t *testing.T, client *scm.Client, repo string)

AssertNoRepoExists asserts that the repository does not exist

func AssertRepoExists added in v1.6.18

func AssertRepoExists(ctx context.Context, t *testing.T, client *scm.Client, repo string) *scm.Repository

AssertRepoExists asserts that the repository exists

func DirExists added in v1.5.164

func DirExists(path string) (bool, error)

DirExists checks if path exists and is a directory

Types

type Data

type Data 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
	PullRequestCommentsAdded   []string
	PullRequestCommentsDeleted []string
	PullRequestLabelsAdded     []string
	PullRequestLabelsRemoved   []string
	PullRequestLabelsExisting  []string
	ReviewID                   int
	Reviews                    map[int][]*scm.Review
	Statuses                   map[string][]*scm.Status
	IssueEvents                map[int][]*scm.ListedIssueEvent
	Commits                    map[string]*scm.Commit
	TestRef                    string
	PullRequestsCreated        map[int]*scm.PullRequestInput
	PullRequestID              int
	CreateRepositories         []*scm.RepositoryInput
	Organizations              []*scm.Organization
	Repositories               []*scm.Repository
	CurrentUser                scm.User
	Users                      []*scm.User
	Hooks                      map[string][]*scm.Hook
	Releases                   map[string]map[int]*scm.Release
	Deployments                map[string][]*scm.Deployment
	DeploymentStatus           map[string][]*scm.DeploymentStatus

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

	// org/repo#number:body
	IssueCommentsAdded []string
	// org/repo#issuecommentid
	IssueCommentsDeleted []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 []DeletedRef

	UserPermissions map[string]map[string]string

	// Invitations the current pending invitations
	Invitations []*scm.Invitation

	// ContentDir the directory used to implement the Content service to access files and directories
	ContentDir string
}

Data is used to store/represent test data for the fake client

func NewData

func NewData() *Data

NewData create a new set of fake data

func NewDefault

func NewDefault() (*scm.Client, *Data)

NewDefault returns a new fake client. The Data object lets you pre-load resources into the fake driver or check for results after the scm operations have been performed

type DeletedRef

type DeletedRef struct {
	Org, Repo, Ref string
}

DeletedRef represents a ref that has been deleted

Jump to

Keyboard shortcuts

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