vcr

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CassetteFileExists

func CassetteFileExists(cassetteName string) (bool, error)

func CassetteFileName

func CassetteFileName(cassetteName string) string

func EnsureCassetteFileExists

func EnsureCassetteFileExists(cassetteName string) error

func HideRecordingData

func HideRecordingData(azureIDs creds.AzureIDs, s string) string

func HideURLData

func HideURLData(azureIDs creds.AzureIDs, s string) string

func RedactRequestHeaders

func RedactRequestHeaders(azureIDs creds.AzureIDs, headers http.Header)

func RedactResponseHeaders

func RedactResponseHeaders(azureIDs creds.AzureIDs, headers http.Header)

Types

type FakeRoundTripper

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

FakeRoundTripper is a fake implementation of http.RoundTripper used in testing.

func NewFakeRoundTripper

func NewFakeRoundTripper() *FakeRoundTripper

func (*FakeRoundTripper) AddError

func (fake *FakeRoundTripper) AddError(request *http.Request, err error)

AddError adds an error to the fake round tripper.

func (*FakeRoundTripper) AddResponse

func (fake *FakeRoundTripper) AddResponse(request *http.Request, response *http.Response)

AddResponse adds a response to the fake round tripper.

func (*FakeRoundTripper) RoundTrip

func (fake *FakeRoundTripper) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

type Interface

type Interface interface {
	// Cfg returns the available configuration for the test
	Cfg() config.Values

	// Creds returns Azure credentials when running for real
	Creds() azcore.TokenCredential

	// IDs returns the available Azure resource IDs for the test
	IDs() creds.AzureIDs

	// Stop recording
	Stop() error

	// IsReplaying returns true if we're replaying a recorded test, false if we're recording a new test
	IsReplaying() bool

	// CreateClient creates an HTTP client configured to record or replay HTTP requests.
	// t is a reference to the test currently executing.
	CreateClient(t *testing.T) *http.Client
}

Interface is a lightweight interface that allows us to swap out implementations of Go-VCR as required.

func NewTestPassthroughRecorder

func NewTestPassthroughRecorder(cfg config.Values) (Interface, error)

NewTestPassthroughRecorder returns an instance of testRecorder that does not record or replay HTTP requests,

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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