Documentation
¶
Index ¶
- Constants
- func SendEventRequest(t *testing.T, event GithubEvent, url, secret string, payload []byte)
- type GithubEvent
- type Hook
- type TestServer
- type TestServerOption
- func WithArchive(tarball []byte) TestServerOption
- func WithCommit(commit string) TestServerOption
- func WithDefaultBranch(branch string) TestServerOption
- func WithDisableTLS() TestServerOption
- func WithHandler(path string, h http.HandlerFunc) TestServerOption
- func WithHook(hook Hook) TestServerOption
- func WithPullRequest(pullNumber string, changedPaths ...string) TestServerOption
- func WithRefs(refs ...string) TestServerOption
- func WithRepo(repo vcs.Repo) TestServerOption
- func WithUsername(username user.Username) TestServerOption
Constants ¶
View Source
const ( PushEvent GithubEvent = "push" PullRequest GithubEvent = "pull_request" WebhookCreated webhookAction = iota WebhookUpdated WebhookDeleted )
Variables ¶
This section is empty.
Functions ¶
func SendEventRequest ¶
func SendEventRequest(t *testing.T, event GithubEvent, url, secret string, payload []byte)
SendEventRequest sends a GitHub event via a http request to the url, signed with the secret,
Types ¶
type TestServer ¶
type TestServer struct {
// webhook created/updated/deleted events channel
WebhookEvents chan webhookEvent
*httptest.Server
// contains filtered or unexported fields
}
func NewTestServer ¶
func NewTestServer(t *testing.T, opts ...TestServerOption) (*TestServer, *url.URL)
func (*TestServer) GetStatus ¶
func (s *TestServer) GetStatus(t *testing.T, ctx context.Context) *github.StatusEvent
GetStatus retrieves a commit status event off the queue, timing out after 10 seconds if nothing is on the queue.
func (*TestServer) HasWebhook ¶
func (s *TestServer) HasWebhook() bool
func (*TestServer) SendEvent ¶
func (s *TestServer) SendEvent(t *testing.T, event GithubEvent, payload []byte)
SendEvent sends an event to the registered webhook.
type TestServerOption ¶
type TestServerOption func(*TestServer)
func WithArchive ¶
func WithArchive(tarball []byte) TestServerOption
func WithCommit ¶
func WithCommit(commit string) TestServerOption
func WithDefaultBranch ¶
func WithDefaultBranch(branch string) TestServerOption
func WithDisableTLS ¶
func WithDisableTLS() TestServerOption
func WithHandler ¶
func WithHandler(path string, h http.HandlerFunc) TestServerOption
func WithHook ¶
func WithHook(hook Hook) TestServerOption
func WithPullRequest ¶
func WithPullRequest(pullNumber string, changedPaths ...string) TestServerOption
func WithRefs ¶
func WithRefs(refs ...string) TestServerOption
func WithRepo ¶
func WithRepo(repo vcs.Repo) TestServerOption
func WithUsername ¶
func WithUsername(username user.Username) TestServerOption
Click to show internal directories.
Click to hide internal directories.