mocktests

package
v1.97.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockRoundTripper

func NewMockRoundTripper() *mockRoundTripper

Types

type HTTPRecorder

type HTTPRecorder struct {
	Requests []Request
	// contains filtered or unexported fields
}

func NewRecorder

func NewRecorder(inner http.RoundTripper) *HTTPRecorder

func (*HTTPRecorder) RoundTrip

func (m *HTTPRecorder) RoundTrip(req *http.Request) (*http.Response, error)

type Harness

type Harness struct {
	*testing.T

	Scheme *runtime.Scheme
	Ctx    context.Context
	Client client.Client
	// contains filtered or unexported fields
}

func NewHarness

func NewHarness(t *testing.T) *Harness

func (*Harness) MustReadFile

func (h *Harness) MustReadFile(p string) string

MustReadFile returns the contents of the file - as a string It fails the test if the file cannot be read

func (*Harness) NewClient

func (h *Harness) NewClient(cache cache.Cache, config *rest.Config, options client.Options, uncachedObjects ...client.Object) (client.Client, error)

func (*Harness) ParseObjects

func (h *Harness) ParseObjects(y string) []*unstructured.Unstructured

func (*Harness) RESTConfig

func (h *Harness) RESTConfig() *rest.Config

func (*Harness) Stop

func (h *Harness) Stop()

func (*Harness) WithObjects

func (h *Harness) WithObjects(initObjs ...*unstructured.Unstructured)

type Request

type Request struct {
	Method string      `json:"method,omitempty"`
	URL    string      `json:"url,omitempty"`
	Header http.Header `json:"header,omitempty"`
	Body   string      `json:"body,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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