test

package
v0.37.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2025 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 provider.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 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 MuxRepoMemberShip

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

func SetupBBDataCenterClient

func SetupBBDataCenterClient() (*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 DiffPath

type DiffPath struct {
	ToString string `json:"toString"`
}

type DiffStat

type DiffStat struct {
	Path    DiffPath  `json:"path"`
	SrcPath *DiffPath `json:"srcPath,omitempty"` // used in lib that's why leaving it here nil
	Type    string    `json:"type"`
}

type DiffStats

type DiffStats struct {
	Pagination
	Values []*DiffStat
}

type DiffType

type DiffType string

type FileType

type FileType string

type Group

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

type LineType

type LineType string

type Pagination

type Pagination struct {
	Start    int  `json:"start"`
	Size     int  `json:"size"`
	Limit    int  `json:"limit"`
	LastPage bool `json:"isLastPage"`
	NextPage int  `json:"nextPageStart"`
}

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