testutil

package
v6.24.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMockServer

func GetMockServer(t *testing.T, url string, method string, statusCode int, response string) *httptest.Server

GetMockServer is a wrapper for returning a more generic MockServer's HTTPServer. If you want more control, construct a MockServer manually

Types

type MockServer

type MockServer struct {
	T               *testing.T
	ExpectedURL     string
	ExpectedMethod  string
	StatusCode      int
	ExpectedRequest string
	Response        string
	SkipRequestBody bool
}

MockServer struct is used to test the how the client sends a request and responds to a servers response

func (*MockServer) GetClient

func (m *MockServer) GetClient() (*repository.Client, func())

GetClient returns a client to the MockServer

func (*MockServer) GetHTTPServer

func (m *MockServer) GetHTTPServer() *httptest.Server

GetHTTPServer returns the server part of the MockServer

Jump to

Keyboard shortcuts

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