httpexpect

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2018 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	URL      string                    `json:"url,omitempty"`    // Base URL prepended to all requests' path.
	Header   testsuite.Header          `json:"header,omitempty"` // Base set of headers added to all requests.
	OAUTH2   *clientcredentials.Config `json:"oauth2,omitempty"`
	Insecure bool                      `json:"insecure,omitempty"`
}

type Config

type Config struct {
	Path  string  `json:"path,omitempty"`
	Root  string  `json:"root,omitempty"`
	Base  Base    `json:"base,omitempty"`
	Tests []*Test `json:"tests,omitempty"`
}

func (*Config) Example

func (*Config) Example() interface{}

type Expect

type Expect struct {
	StatusCode int              `json:"statusCode,omitempty"`
	Header     testsuite.Header `json:"header,omitempty"`

	Document   interface{}            `json:"document,omitempty"`   // Exact document to match. Exclusive with JSONSchema.
	JSONSchema map[string]interface{} `json:"jsonSchema,omitempty"` // Exact JSON schema to match. Exclusive with Document.
	JSONValues map[string]interface{} `json:"jsonValues,omitempty"` // Required JSON values. Optional, if JSONSchema is set.
}

type Request

type Request struct {
	URL    string           `json:"url,omitempty"` // If set, will overwrite the base URL.
	Path   string           `json:"path,omitempty"`
	Method string           `json:"method,omitempty"`
	Header testsuite.Header `json:"header,omitempty"`

	// Only one of the three following must be set.
	Body      interface{}       `json:"body,omitempty"`
	Multipart map[string]string `json:"multipart,omitempty"`
	FormData  map[string]string `json:"formData,omitempty"`
}

type Suite

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

Suite describes an HTTP test suite.

func New

func New(cfg *Config) (*Suite, error)

New returns a Suite.

func (*Suite) Tests

func (s *Suite) Tests() []testsuite.Test

type Test

type Test struct {
	ID           string  `json:"id,omitempty"`
	Name         string  `json:"name,omitempty"`    // Name used to identify this test.
	Request      Request `json:"request,omitempty"` // Request describes the HTTP request.
	Expect       Expect  `json:"expect,omitempty"`  // Expect describes the expected result of the HTTP request.
	SaveDocument bool    `json:"saveDocument,omitempty"`
}

Jump to

Keyboard shortcuts

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