test

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeAPIServer

func MakeAPIServer(t *testing.T, urlPath, ref, fixture string) *httptest.Server

MakeAPIServer is used during testing to create an HTTP server to return fixtures if the request matches.

func MakeHookRequest

func MakeHookRequest(t *testing.T, fixture, eventType string, changes ...fixtureFunc) *http.Request

MakeHookRequest creates and returns a new http.Request that resembles a GitHub hook request, including the correct event type and reading and sending a fixture as a JSON body.

Optionally changes can be applied to the fixture that is read, before it's sent. TODO use uuid to generate the Delivery ID.

func ReadJSONFixture

func ReadJSONFixture(t *testing.T, filename string) map[string]interface{}

ReadJSONFixture reads a filename into a map, and fails the test if it is unable to open or parse the file.

func UnmarshalJSON

func UnmarshalJSON(t *testing.T, b []byte) map[string]interface{}

UnmarshalJSON unmarshals a byte-slice to a map.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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