tests

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package tests contains various tests helpers and utilities to assist with the S3 client testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectHeaders

func ExpectHeaders(headers http.Header, expectations map[string]string) bool

ExpectHeaders checks whether specified headers match the expectations. The expectations map entry key is the header name. The expectations map entry value is the first header value. If wrapped with `^...$` it is compared as regular expression.

Types

type Client

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

func NewClient

func NewClient(stubs ...*RequestStub) *Client

NewClient creates a new test Client loaded with the specified RequestStubs.

func (*Client) AssertNoRemaining

func (c *Client) AssertNoRemaining() error

AssertNoRemaining asserts that current client has no unprocessed requests remaining.

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

Do implements the [s3.HTTPClient] interface.

type RequestStub

type RequestStub struct {
	Method   string
	URL      string // plain string or regex pattern wrapped in "^pattern$"
	Match    func(req *http.Request) bool
	Response *http.Response
}

Jump to

Keyboard shortcuts

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