test

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(client *http.Client, config Config, cmd *Command) ([]byte, *http.Header, int, error)

func Execute

func Execute(t *testing.T, config Config, tests []Test)

func InitClient

func InitClient() *http.Client

func Prepare

func Prepare(config Config, commands []Command)

func PrepareRequest

func PrepareRequest(config Config, cmd *Command) (*http.Request, error)

func ReadResponse

func ReadResponse(resp *http.Response) ([]byte, *http.Header, int, error)

Types

type Command

type Command struct {
	Description string
	Method      string
	Query       string
	Body        string
	Headers     Headers
}

type Config

type Config struct {
	BaseUrl       string
	CommonHeaders Headers
}

type Headers

type Headers http.Header

type Test

type Test struct {
	Description     string
	Method          string
	Query           string
	Body            string
	Headers         Headers
	Expected        string
	ExpectedHeaders map[string]string
	Status          int
}

We don't embed Command to simplify tests writing

Jump to

Keyboard shortcuts

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