Help us shape the future of Go! Take the 2026 Go Developer Survey

mocktest

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServerWithQuery added in v2.3.0

func ServerWithQuery(t *testing.T, query string) string

ServerWithQuery starts a server that hands each request to the mock server with the given query params set, and returns its URL to pass as `--base-url`. The mock server needs them to tell two operations with the same path apart.

func TestFile

func TestFile(t *testing.T, contents string) string

func TestRunMockTestWithFlags

func TestRunMockTestWithFlags(t *testing.T, args ...string)

TestRunMockTestWithFlags runs a test against a mock server with the provided CLI args and ensures it succeeds

func TestRunMockTestWithPipeAndFlags

func TestRunMockTestWithPipeAndFlags(t *testing.T, pipeData []byte, args ...string)

TestRunMockTestWithPipeAndFlags runs a test against a mock server with the provided data piped over stdin and CLI args and ensures it succeeds

Types

type OnlyMockServerDialer

type OnlyMockServerDialer struct{}

OnlyMockServerDialer only allows network connections to the mock server

func (*OnlyMockServerDialer) DialContext

func (d *OnlyMockServerDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

Jump to

Keyboard shortcuts

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