model

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusAssertion asserts response status
	StatusAssertion assertionKind = "status"
	// BodyAssertion asserts response body
	BodyAssertion assertionKind = "body"
)
View Source
const (
	GET     httpMethod = "GET"
	POST    httpMethod = "POST"
	PUT     httpMethod = "PUT"
	PATCH   httpMethod = "PATCH"
	DELETE  httpMethod = "DELETE"
	OPTIONS httpMethod = "OPTIONS"
	HEAD    httpMethod = "HEAD"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Assertion

type Assertion struct {
	Kind     assertionKind
	Expected interface{}
	Actual   interface{}
	Msg      string
}

Assertion is a result of predicate execution

func (*Assertion) String

func (a *Assertion) String() string

String formats an Assertion as a string

func (*Assertion) True

func (a *Assertion) True() bool

type Assertions

type Assertions struct {
	Name       string       `json:"name"`
	Assertions []*Assertion `json:"assertions"`
}

Assertions is a logical aggregation of assertion

func NewAssertions

func NewAssertions(name string) *Assertions

NewAssertions creates an empty Assertions

func (*Assertions) AddOf

func (as *Assertions) AddOf(kind assertionKind, expected, actual interface{}, msg string)

AddOf adds a new assertion

type Playbook

type Playbook struct {
	Name   string   `json:"name"`
	Vars   Vars     `json:"vars"`
	Stages []*Stage `json:"stages"`
}

Playbook is a named stages composition

type Request

type Request struct {
	Url     string                 `json:"url"`
	Method  httpMethod             `json:"method"`
	Json    map[string]interface{} `json:"json"`
	Form    map[string]string      `json:"form"`
	Query   map[string]string      `json:"query"`
	Headers map[string]string      `json:"headers"`
}

Request describes an http request to be executed as apart of a stage

type Response

type Response struct {
	Code int                    `json:"code"`
	Body map[string]interface{} `json:"body"`
	Save *SaveResp              `json:"save"`
}

Request describes an http response to be asserted as apart of a stage

type SaveResp

type SaveResp struct {
	Body map[string]string `json:"body"`
}

type Stage

type Stage struct {
	Name     string    `json:"name"`
	Request  *Request  `json:"request"`
	Response *Response `json:"response"`
}

Stage is a test to be executed within a playbook

type Vars

type Vars map[string]interface{}

Vars is a map of flat key value pairs

func (Vars) AddOf

func (vars Vars) AddOf(key string, value interface{})

func (Vars) Resolve

func (vars Vars) Resolve(withEnvVars bool) error

Jump to

Keyboard shortcuts

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