testing

package
v0.0.0-...-c4221d4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Comment

func Comment(id int, login string, createdAt time.Time, body string) github.IssueComment

Comment is a helper to create a valid-ish comment for testing

func Commit

func Commit(sha string, t int64) *github.Commit

Commit returns a filled out github.Commit which happened at time.Unix(t, 0)

func Commits

func Commits(num int, time int64) []github.RepositoryCommit

Commits returns an array of github.RepositoryCommits. The first commit will have happened at time `time`, the next commit `time + 1`, etc

func Events

func Events(labels []LabelTime) []github.IssueEvent

Events returns a slice of github.IssueEvent where the specified labels were applied at the specified times

func InitServer

func InitServer(t *testing.T, issue *github.Issue, pr *github.PullRequest, events []github.IssueEvent, commits []github.RepositoryCommit, status *github.CombinedStatus, masterCommit *github.RepositoryCommit) (*github.Client, *httptest.Server, *http.ServeMux)

InitServer will return a github.Client which will talk to httptest.Server, to retrieve information from the http.ServeMux. If an issue, pr, events, or commits are supplied it will repond with those on o/r/

func Issue

func Issue(user string, number int, labels []string, isPR bool) *github.Issue

Issue returns a filled out github.Issue

func PullRequest

func PullRequest(user string, merged, mergeDetermined, mergeable bool) *github.PullRequest

PullRequest returns a filled out github.PullRequest

func ServeIssue

func ServeIssue(t *testing.T, mux *http.ServeMux, issue *github.Issue)

ServeIssue is a helper to load additional issues into the test server

func Status

func Status(sha string, success []string, fail []string, pending []string, errored []string) *github.CombinedStatus

Status returns a github.CombinedStatus

Types

type LabelTime

type LabelTime struct {
	User  string
	Label string
	Time  int64
}

LabelTime is a struct which can be used to call Events() It expresses what label the event should be about and what time the event took place.

Jump to

Keyboard shortcuts

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