azuretesting

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonMarshalRaw

func JsonMarshalRaw(v interface{}, allow ...reflect.Type) ([]byte, error)

JsonMarshalRaw does the same a json.Marshal, except that it does not use the MarshalJSON methods of the value being marshaled. If any types are specified in the allow set then those will use their MarshalJSON method.

Many of the types in the Azure SDK have MarshalJSON which skip over fields that are marked as READ-ONLY, this is useful for the client, but a problem when pretending to be a server.

func RequestRecorder

func RequestRecorder(requests *[]*http.Request) autorest.PrepareDecorator

RequestRecorder returns an autorest.PrepareDecorator that records requests to ghe given slice.

Types

type MockSender

type MockSender struct {
	*mocks.Sender

	// PathPattern, if non-empty, is assumed to be a regular expression
	// that must match the request path.
	PathPattern string
}

MockSender is a wrapper around autorest/mocks.Sender, extending it with request path checking to ease testing.

func NewSenderWithValue

func NewSenderWithValue(v interface{}) *MockSender

NewSenderWithValue returns a *mocks.Sender that marshals the provided object to JSON and sets it as the content. This function will panic if marshalling fails.

func (*MockSender) Do

func (s *MockSender) Do(req *http.Request) (*http.Response, error)

type Senders

type Senders []autorest.Sender

Senders is a Sender that includes a collection of Senders, which will be called in sequence.

func (*Senders) Do

func (s *Senders) Do(req *http.Request) (*http.Response, error)

type SerialSender

type SerialSender struct {
	// contains filtered or unexported fields
}

SerialSender is a Sender that permits only one active Do call at a time.

func NewSerialSender

func NewSerialSender(s autorest.Sender) *SerialSender

func (*SerialSender) Do

func (s *SerialSender) Do(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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