Help us shape the future of Go! Take the 2026 Go Developer Survey

test

package
v0.50.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeEvent

func MakeEvent(event *info.Event) *info.Event

MakeEvent should we try to reflect? or json.Marshall? may be better ways, right?

func MakePREvent

func MakePREvent(event *info.Event, comment string) *types.PullRequestEvent

func MakePushEvent

func MakePushEvent(event *info.Event, changes []types.PushRequestEventChange, commits []types.Commit) *types.PushRequestEvent

func MuxCommitInfo

func MuxCommitInfo(t *testing.T, mux *http.ServeMux, event *info.Event, commit scm.Commit)

func MuxCreateAndTestCommitStatus

func MuxCreateAndTestCommitStatus(t *testing.T, mux *http.ServeMux, event *info.Event, expectedDescSubstr string, expStatus status.StatusOpts)

func MuxCreateComment

func MuxCreateComment(t *testing.T, mux *http.ServeMux, event *info.Event, expectedCommentSubstr string, prID int)

func MuxDefaultBranch

func MuxDefaultBranch(t *testing.T, mux *http.ServeMux, event *info.Event, defaultBranch, latestCommit string)

func MuxDirContent

func MuxDirContent(t *testing.T, mux *http.ServeMux, event *info.Event, testDir, targetDirName string, wantDirErr, wantFilesErr bool)

func MuxFiles

func MuxFiles(_ *testing.T, mux *http.ServeMux, event *info.Event, _, targetDirName string, filescontents map[string]string, wantErr bool)

func MuxGroupMembers added in v0.42.0

func MuxGroupMembers(t *testing.T, mux *http.ServeMux, groupMembers map[string][]GroupMember)

MuxGroupMembers mocks the /admin/groups/more-members endpoint used by go-scm to resolve group names to individual users. groupMembers maps group name to the list of members in that group.

func MuxListDir

func MuxListDir(t *testing.T, mux *http.ServeMux, event *info.Event, path string, files []string, wantErr bool)

func MuxProjectGroupMembership

func MuxProjectGroupMembership(t *testing.T, mux *http.ServeMux, event *info.Event, groups []*ProjGroup)

func MuxProjectMemberShip

func MuxProjectMemberShip(t *testing.T, mux *http.ServeMux, event *info.Event, userperms []*UserPermission)

func MuxPullRequestActivities

func MuxPullRequestActivities(t *testing.T, mux *http.ServeMux, event *info.Event, prNumber int, activities []*Activity)

func MuxRepoGroupMembership added in v0.42.0

func MuxRepoGroupMembership(t *testing.T, mux *http.ServeMux, event *info.Event, groups []*ProjGroup)

func MuxRepoMemberShip

func MuxRepoMemberShip(t *testing.T, mux *http.ServeMux, event *info.Event, userperms []*UserPermission)

func SetupBBDataCenterClient

func SetupBBDataCenterClient(t *testing.T) (*scm.Client, *http.ServeMux, func(), string)

Types

type Action

type Action string

type Activity

type Activity struct {
	ID               int                   `json:"id"`
	CreatedDate      int                   `json:"createdDate"`
	User             types.User            `json:"user"`
	Action           Action                `json:"action"`
	CommentAction    string                `json:"commentAction"`
	Comment          types.ActivityComment `json:"comment"`
	CommentAnchor    Anchor                `json:"commentAnchor"`
	FromHash         string                `json:"fromHash,omitempty"`
	PreviousFromHash string                `json:"previousFromHash,omitempty"`
	PreviousToHash   string                `json:"previousToHash,omitempty"`
	ToHash           string                `json:"toHash,omitempty"`
	Added            CommitsStats          `json:"added"`
	Removed          CommitsStats          `json:"removed"`
}

type Anchor

type Anchor struct {
	DiffType DiffType `json:"diffType,omitempty"`
	Line     int      `json:"line,omitempty"`
	LineType LineType `json:"lineType,omitempty"`
	FileType FileType `json:"fileType,omitempty"`
	FromHash string   `json:"fromHash,omitempty"`
	Path     string   `json:"path,omitempty"`
	SrcPath  string   `json:"srcPath,omitempty"`
	ToHash   string   `json:"toHash,omitempty"`
}

type Branch

type Branch struct {
	ID              string `json:"id"`
	DisplayID       string `json:"displayId"`
	Type            string `json:"type"`
	LatestCommit    string `json:"latestCommit"`
	LatestChangeset string `json:"latestChangeset"`
	IsDefault       bool   `json:"isDefault"`
}

type BuildStatus

type BuildStatus struct {
	State       string `json:"state"`
	Key         string `json:"key"`
	Name        string `json:"name"`
	URL         string `json:"url"`
	Description string `json:"description"`
	DateAdded   int64  `json:"dateAdded"`
}

type Comment

type Comment struct {
	Text   string  `json:"text"`
	Parent *Parent `json:"parent,omitempty"`
	Anchor *Anchor `json:"anchor,omitempty"`
}

type CommitsStats

type CommitsStats struct {
	Commits []types.Commit `json:"commits"`
	Total   int            `json:"total"`
}

type DiffType

type DiffType string

type FileType

type FileType string

type Group

type Group struct {
	Name string `json:"name"`
}

type GroupMember added in v0.42.0

type GroupMember struct {
	Name string `json:"name"`
	Slug string `json:"slug"`
}

GroupMember matches the member struct in go-scm's stash driver, returned by the /admin/groups/more-members endpoint.

type LineType

type LineType string

type Parent

type Parent struct {
	ID int `json:"id"`
}

type ProjGroup

type ProjGroup struct {
	Group      Group  `json:"group"`
	Permission string `json:"permission"`
}

type UserPermission

type UserPermission struct {
	User       types.User `json:"user"`
	Permission string     `json:"permission"`
}

Jump to

Keyboard shortcuts

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