yaml_file

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaseData

type CaseData struct {
	RequestArgs      map[string]interface{}         `json:"requestArgs" yaml:"requestArgs"`
	ResponseArgs     map[int]map[string]interface{} `json:"responseArgs" yaml:"responseArgs"`
	BeforeScriptArgs map[string]interface{}         `json:"beforeScriptArgs" yaml:"beforeScriptArgs"`
	DbQueryArgs      map[string]interface{}         `json:"dbQueryArgs" yaml:"dbQueryArgs"`
	DbResponseArgs   map[string]interface{}         `json:"dbResponseArgs" yaml:"dbResponseArgs"`
	DbResponse       []string                       `json:"dbResponse" yaml:"dbResponse"`
}

type Test

type Test struct {
	models.TestInterface

	TestDefinition

	Request         string
	Responses       map[int]string
	ResponseHeaders map[int]map[string]string
	BeforeScript    string
	DbQuery         string
	DbResponse      []string
}

func (*Test) BeforeScriptPath

func (t *Test) BeforeScriptPath() string

func (*Test) BeforeScriptTimeout

func (t *Test) BeforeScriptTimeout() int

func (*Test) Clone

func (t *Test) Clone() models.TestInterface

func (*Test) ContentType

func (t *Test) ContentType() string

TODO: it might make sense to do support of case-insensitive checking

func (*Test) Cookies

func (t *Test) Cookies() map[string]string

func (*Test) DbQueryString

func (t *Test) DbQueryString() string

func (*Test) DbResponseJson

func (t *Test) DbResponseJson() []string

func (*Test) DisallowExtraFields

func (t *Test) DisallowExtraFields() bool

func (*Test) Fixtures

func (t *Test) Fixtures() []string

func (*Test) GetForm

func (t *Test) GetForm() *models.Form

func (*Test) GetMethod

func (t *Test) GetMethod() string

func (*Test) GetName

func (t *Test) GetName() string

func (*Test) GetRequest

func (t *Test) GetRequest() string

func (*Test) GetResponse

func (t *Test) GetResponse(code int) (string, bool)

func (*Test) GetResponseHeaders

func (t *Test) GetResponseHeaders(code int) (map[string]string, bool)

func (*Test) GetResponses

func (t *Test) GetResponses() map[int]string

func (*Test) GetVariables

func (t *Test) GetVariables() map[string]string

func (*Test) GetVariablesToSet

func (t *Test) GetVariablesToSet() map[int]map[string]string

func (*Test) Headers

func (t *Test) Headers() map[string]string

func (*Test) IgnoreArraysOrdering

func (t *Test) IgnoreArraysOrdering() bool

func (*Test) NeedsCheckingValues

func (t *Test) NeedsCheckingValues() bool

func (*Test) Path

func (t *Test) Path() string

func (*Test) Pause

func (t *Test) Pause() int

func (*Test) ServiceMocks

func (t *Test) ServiceMocks() map[string]interface{}

func (*Test) SetForm

func (t *Test) SetForm(val *models.Form)

func (*Test) SetHeaders

func (t *Test) SetHeaders(val map[string]string)

func (*Test) SetMethod

func (t *Test) SetMethod(val string)

func (*Test) SetPath

func (t *Test) SetPath(val string)

func (*Test) SetQuery

func (t *Test) SetQuery(val string)

func (*Test) SetRequest

func (t *Test) SetRequest(val string)

func (*Test) SetResponses

func (t *Test) SetResponses(val map[int]string)

func (*Test) ToJSON

func (t *Test) ToJSON() ([]byte, error)

func (*Test) ToQuery

func (t *Test) ToQuery() string

type TestDefinition

type TestDefinition struct {
	Name               string                    `json:"name" yaml:"name"`
	Variables          map[string]string         `json:"variables" yaml:"variables"`
	VariablesToSet     VariablesToSet            `json:"variables_to_set" yaml:"variables_to_set"`
	Form               *models.Form              `json:"form" yaml:"form"`
	Method             string                    `json:"method" yaml:"method"`
	RequestURL         string                    `json:"path" yaml:"path"`
	QueryParams        string                    `json:"query" yaml:"query"`
	RequestTmpl        string                    `json:"request" yaml:"request"`
	ResponseTmpls      map[int]string            `json:"response" yaml:"response"`
	ResponseHeaders    map[int]map[string]string `json:"responseHeaders" yaml:"responseHeaders"`
	BeforeScriptParams beforeScriptParams        `json:"beforeScript" yaml:"beforeScript"`
	HeadersVal         map[string]string         `json:"headers" yaml:"headers"`
	CookiesVal         map[string]string         `json:"cookies" yaml:"cookies"`
	Cases              []CaseData                `json:"cases" yaml:"cases"`
	ComparisonParams   comparisonParams          `json:"comparisonParams" yaml:"comparisonParams"`
	FixtureFiles       []string                  `json:"fixtures" yaml:"fixtures"`
	MocksDefinition    map[string]interface{}    `json:"mocks" yaml:"mocks"`
	PauseValue         int                       `json:"pause" yaml:"pause"`
	DbQueryTmpl        string                    `json:"dbQuery" yaml:"dbQuery"`
	DbResponseTmpl     []string                  `json:"dbResponse" yaml:"dbResponse"`
}

type VariablesToSet

type VariablesToSet map[int]map[string]string

func (*VariablesToSet) UnmarshalYAML

func (v *VariablesToSet) UnmarshalYAML(unmarshal func(interface{}) error) error

There can be two types of data in yaml-file:

  1. JSON-paths: VariablesToSet: <code1>: <varName1>: <JSON_Path1> <varName2>: <JSON_Path2>
  2. Plain text: VariablesToSet: <code1>: <varName1> <code2>: <varName2> ... In this case we unmarshall values to format similar to JSON-paths format with empty paths: VariablesToSet: <code1>: <varName1>: "" <code2>: <varName2>: ""

type YamlFileLoader

type YamlFileLoader struct {
	testloader.LoaderInterface
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader(testsLocation string) *YamlFileLoader

func (*YamlFileLoader) Load

func (l *YamlFileLoader) Load() (chan models.TestInterface, error)

func (*YamlFileLoader) SetFileFilter

func (l *YamlFileLoader) SetFileFilter(f string)

Jump to

Keyboard shortcuts

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