Back to

Package step

Latest Go to latest
Published: Jul 9, 2020 | License: GPL3 | Module:


Package Files

func NewBodyExtractor

func NewBodyExtractor() extractor

func NewHTTPValidator

func NewHTTPValidator() validator

NewHTTPValidator instantiates a new HTTPValidator

func NewTemplateInterpolator

func NewTemplateInterpolator() *templateInterpolator

NewTemplateInterpolator instantiates a new template interpolator

type Executor

type Executor interface {
	Do(Request) (*http.Response, error)

func NewHTTPExecutor

func NewHTTPExecutor(client http.Client) Executor

NewHTTPExecutor instantiates a new http executor

func NewRemoteHTTPExecutor

func NewRemoteHTTPExecutor(client *native.Client, apiKey string, region string) (Executor, error)

NewRemoteHTTPExecutor instantiates a new http executor

type ExpectBody

type ExpectBody struct {
	Selector *string `yaml:"selector"`
	KeysOnly *bool   `yaml:"keys_only"`
	Subset   *bool   `yaml:"subset"`
	Is       string  `yaml:"is"`

type ExpectedResponse

type ExpectedResponse struct {
	Code    *int          `yaml:"code"`
	Headers *Headers      `yaml:"headers"`
	Body    []*ExpectBody `yaml:"body" validate:"expectBody"`

type Export

type Export map[string]string

type Exported

type Exported map[string]interface{}

func (Exported) Generic

func (e Exported) Generic() map[string]interface{}

type Headers

type Headers map[string][]string

func (*Headers) UnmarshalYAML

func (r *Headers) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML unmarshalls yaml in the format

           header1: 1
           header1: 4
           header2: [2,3]
			  header3: 1

into Headers to result in

  header1: [1,4],
  header2: [2,3],
  header3: [1],

type PreparedStep

type PreparedStep Step

PreparedStep is the same as step, but with replaced template tokens

type Request

type Request struct {
	// Type if the method of the request
	Type                string  `yaml:"method" validate:"required"`
	Endpoint            string  `yaml:"endpoint" validate:"required"`
	Headers             Headers `yaml:"headers"`
	Body                string  `yaml:"body"`
	SkipSSLVerification *bool   `yaml:"skip_ssl_verify"`

Request is a single step request data

type Result

type Result struct {
	Step     PreparedStep
	Timings  http.Timings
	Exported Exported
	Valid    ValidationResult

Result has all the data about the step execution

func (*Result) AddErr

func (r *Result) AddErr(key string, err error)

func (Result) OK

func (r Result) OK() bool

type Runner

type Runner interface {
	Run(Step, variables.Variables) (Result, error)

Runner takes a step and variables and checks if it returns the expected data

func NewRunner

func NewRunner(
	executor Executor,
	validator validator,
	interpolator interpolator,
	extractor extractor) Runner

NewRunner instantiates a new HTTPRunner

type Step

type Step struct {
	ID        string              `yaml:"id" validate:"required"`
	Variables variables.Variables `yaml:"variables"`
	Request   Request             `yaml:"request" validate:"required"`
	Response  ExpectedResponse    `yaml:"expect"`
	Export    Export              `yaml:"export"`

Step is the data for a single endpoint

type ValidationResult

type ValidationResult struct {
	Errors map[string]string // a list of error keys and more information about what caused them

ValidationResult holds information if the validation succeeded or not and what errors were encountered if any

func (ValidationResult) OK

func (r ValidationResult) OK() bool

OK returns overall check status, true only if every other check passes

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier