testutils

package
v0.0.0-...-bc12874 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FakeGerritURL is a fake Gerrit URL.
	FakeGerritURL = "https://fake-skia-review.googlesource.com"
	// FakeGitCookies are fake .gitcookies contents.
	FakeGitCookies = ".googlesource.com\tTRUE\t/\tTRUE\t123\to\tgit-user.google.com=abc123"
	// FakeChangeId is the Change ID used for changes uploaded to MockGerrit.
	FakeChangeId = "123"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MockGerrit

type MockGerrit struct {
	Gerrit *gerrit.Gerrit
	Mock   *mockhttpclient.URLMock
	// contains filtered or unexported fields
}

MockGerrit is a GerritInterface implementation which mocks out requests to the server.

func NewGerrit

func NewGerrit(t sktest.TestingT) *MockGerrit

NewGerrit returns a mocked Gerrit instance.

func NewGerritWithConfig

func NewGerritWithConfig(t sktest.TestingT, cfg *gerrit.Config) *MockGerrit

NewGerritWithConfig returns a mocked Gerrit instance which uses the given Config.

func (*MockGerrit) Abandon

func (g *MockGerrit) Abandon(ci *gerrit.ChangeInfo, msg string)

Abandon mocks the request to abandon the change.

func (*MockGerrit) AssertEmpty

func (g *MockGerrit) AssertEmpty()

AssertEmpty asserts that the URLMock instance is empty.

func (*MockGerrit) MakePostRequest

func (g *MockGerrit) MakePostRequest(ci *gerrit.ChangeInfo, msg string, labels map[string]int, reviewers []string) (string, []byte)

MakePostRequest creates a POST request to Gerrit for mocking.

func (*MockGerrit) MockAddComment

func (g *MockGerrit) MockAddComment(ci *gerrit.ChangeInfo, msg string, reviewers []string)

MockAddComment mocks addition of a comment to the change.

func (*MockGerrit) MockDownloadCommitMsgHook

func (g *MockGerrit) MockDownloadCommitMsgHook()

MockDownloadCommitMsgHook mocks the request to download the commit message hook.

func (*MockGerrit) MockGetIssueProperties

func (g *MockGerrit) MockGetIssueProperties(ci *gerrit.ChangeInfo)

MockGetIssueProperties mocks the requests for GetIssueProperties.

func (*MockGerrit) MockGetTrybotResults

func (g *MockGerrit) MockGetTrybotResults(ci *gerrit.ChangeInfo, patchset int, results []*buildbucketpb.Build)

MockGetTrybotResults mocks the requests for GetIssueProperties.

func (*MockGerrit) MockGetUserEmail

func (g *MockGerrit) MockGetUserEmail(acc *gerrit.AccountDetails)

MockGetUserEmail mocks the requests for GetUserEmail.

func (*MockGerrit) MockPost

func (g *MockGerrit) MockPost(ci *gerrit.ChangeInfo, msg string, labels map[string]int, reviewers []string)

MockPost mocks a POST request to the given change with the given message and labels.

func (*MockGerrit) MockSetCQ

func (g *MockGerrit) MockSetCQ(ci *gerrit.ChangeInfo, msg string, reviewers []string)

MockSetCQ mocks the setting of the commit queue labels.

func (*MockGerrit) MockSetDryRun

func (g *MockGerrit) MockSetDryRun(ci *gerrit.ChangeInfo, msg string, reviewers []string)

MockSetDryRun mocks the setting of the dry run labels.

Jump to

Keyboard shortcuts

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