testutils

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFailWriter

func CreateFailWriter(writeLimit int) io.WriteCloser

CreateFailWriter returns a io.WriteCloser that returns an error after the amount of writes indicated by writeLimit

func JSONRespondMust added in v0.6.0

func JSONRespondMust(code int, response interface{}) httpmock.Responder

JSONRespondMust creates a httpmock.Responder with the given response as the body, and fails the test if it cannot be created

func TestConfigGetEnumsCount

func TestConfigGetEnumsCount(config types.ServiceConfig, expectedCount int)

TestConfigGetEnumsCount tests whether the config.Enums returns the expected amount of items

func TestConfigGetFieldsCount

func TestConfigGetFieldsCount(config types.ServiceConfig, expectedCount int)

TestConfigGetFieldsCount tests whether the config.QueryFields return the expected amount of fields

func TestConfigGetInvalidQueryValue

func TestConfigGetInvalidQueryValue(config types.ServiceConfig)

TestConfigGetInvalidQueryValue tests whether the config returns an error when an invalid query value is requested

func TestConfigSetDefaultValues added in v0.6.0

func TestConfigSetDefaultValues(config types.ServiceConfig)

TestConfigSetDefaultValues tests whether setting the default values can be set for an empty config without any errors

func TestConfigSetInvalidQueryValue

func TestConfigSetInvalidQueryValue(config types.ServiceConfig, rawInvalidURL string)

TestConfigSetInvalidQueryValue tests whether the config returns an error when a URL with an invalid query value is parsed

func TestLogger added in v0.6.0

func TestLogger() *log.Logger

TestLogger returns a log.Logger that writes to ginkgo.GinkgoWriter for use in tests

func TestServiceSetInvalidParamValue added in v0.6.0

func TestServiceSetInvalidParamValue(service types.Service, key string, value string)

TestServiceSetInvalidParamValue tests whether the service returns an error when an invalid param key/value is passed through Send

func URLMust added in v0.6.0

func URLMust(rawURL string) *url.URL

URLMust creates a url.URL from the given rawURL and fails the test if it cannot be parsed

Types

type Eavesdropper

type Eavesdropper interface {
	GetConversation(includeGreeting bool) string
}

Eavesdropper is an interface that provides a way to get a summarized output of a connection RX and TX

func CreateTextConFaker

func CreateTextConFaker(responses []string, delim string) (*textproto.Conn, Eavesdropper)

CreateTextConFaker returns a textproto.Conn to fake textproto based connections

type MockClientService added in v0.6.0

type MockClientService interface {
	GetHTTPClient() *http.Client
}

MockClientService is used to allow mocking the HTTP client when testing

Jump to

Keyboard shortcuts

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