test

package
v0.0.0-...-ddb4624 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CommentID is the ID for the test GitHub comment.
	CommentID = 117

	// IssueNumber is number for the test GitHub issue.
	IssueNumber = 42

	// Repository is the GitHub test repository name.
	Repository = "repository"

	// Username is the GitHub test username.
	Username = "icecrime"
)

Variables

View Source
var CommitSHA = []string{"d34db33f", "badc0ff33"}

CommitSHA is an array of arbitrary Git SHA for testing purpose.

Functions

func AssertExpectations

func AssertExpectations(clt *TestClient, t *testing.T)

AssertExpectations asserts mock expectations for all different GitHub services.

func MakeLabel

func MakeLabel(name string) github.Label

MakeLabel is a helper to create a GitHub label.

func MakeStatus

func MakeStatus(context, status string, createdAt time.Time) *github.RepoStatus

MakeStatus is a helper to create a GitHub repository status.

Types

type IssueBuilder

type IssueBuilder struct {
	Value *github.Issue
}

IssueBuilder is a helper type to generate an issue object.

func NewIssueBuilder

func NewIssueBuilder(number int) *IssueBuilder

NewIssueBuilder returns a new IssueBuilder instance.

func (*IssueBuilder) Body

func (p *IssueBuilder) Body(body string) *IssueBuilder

Body sets the body attribute of the issue.

func (*IssueBuilder) Item

func (p *IssueBuilder) Item() gh.Item

Item returns the the underlying issue as an item.

func (*IssueBuilder) Labels

func (p *IssueBuilder) Labels(names []string) *IssueBuilder

Labels sets the labels of the issue.

func (*IssueBuilder) Number

func (p *IssueBuilder) Number(number int) *IssueBuilder

Number sets the number of the issue.

type PullRequestBuilder

type PullRequestBuilder struct {
	Value *github.PullRequest
}

PullRequestBuilder is a helper type to generate a pull request object.

func NewPullRequestBuilder

func NewPullRequestBuilder(number int) *PullRequestBuilder

NewPullRequestBuilder returns a new PullRequestBuilder instance.

func (*PullRequestBuilder) BaseBranch

func (p *PullRequestBuilder) BaseBranch(username, repository, ref string, SHA string) *PullRequestBuilder

BaseBranch sets the Base attribute of the pull request.

func (*PullRequestBuilder) Body

Body sets the body attribute of the pull request.

func (*PullRequestBuilder) Commits

func (p *PullRequestBuilder) Commits(commits int) *PullRequestBuilder

Commits sets the commits objects of the pull request.

func (*PullRequestBuilder) HeadBranch

func (p *PullRequestBuilder) HeadBranch(username, repository, ref string, SHA string) *PullRequestBuilder

HeadBranch sets the Head attribute of the pull request.

func (*PullRequestBuilder) Item

func (p *PullRequestBuilder) Item() gh.Item

Item returns the the underlying pull request as an item.

func (*PullRequestBuilder) Merged

func (p *PullRequestBuilder) Merged(merged bool) *PullRequestBuilder

Merged sets the Merge attribute of the pull request.

func (*PullRequestBuilder) Number

func (p *PullRequestBuilder) Number(number int) *PullRequestBuilder

Number sets the number of the pull request.

func (*PullRequestBuilder) State

func (p *PullRequestBuilder) State(state string) *PullRequestBuilder

State sets the state of the pull request.

func (*PullRequestBuilder) Title

func (p *PullRequestBuilder) Title(title string) *PullRequestBuilder

Title sets the title of the pull request.

type TestClient

type TestClient struct {
	MockIssues       mocks.IssuesService
	MockPullRequests mocks.PullRequestsService
	MockRepositories mocks.RepositoriesService
	MockSearch       mocks.SearchService
}

TestClient is a mocked implementation of a GitHub client.

func (*TestClient) Issues

func (t *TestClient) Issues() gh.IssuesService

Issues returns the issue service instance.

func (*TestClient) PullRequests

func (t *TestClient) PullRequests() gh.PullRequestsService

PullRequests returns the pull request service instance.

func (*TestClient) Repositories

func (t *TestClient) Repositories() gh.RepositoriesService

Repositories returns the repository service instance.

func (*TestClient) Search

func (t *TestClient) Search() gh.SearchService

Search returns the search service instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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