yaml_file

package
v1.21.4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 10 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"`
	AfterRequestScriptArgs map[string]interface{}         `json:"afterRequestScriptArgs" yaml:"afterRequestScriptArgs"`
	DbQueryArgs            map[string]interface{}         `json:"dbQueryArgs" yaml:"dbQueryArgs"`
	DbResponseArgs         map[string]interface{}         `json:"dbResponseArgs" yaml:"dbResponseArgs"`
	DbResponse             []string                       `json:"dbResponse" yaml:"dbResponse"`
	Description            string                         `json:"description" yaml:"description"`
	Variables              map[string]interface{}         `json:"variables" yaml:"variables"`
}

type DatabaseCheck added in v1.18.0

type DatabaseCheck struct {
	DbQueryTmpl    string   `json:"dbQuery" yaml:"dbQuery"`
	DbResponseTmpl []string `json:"dbResponse" yaml:"dbResponse"`
}

type Test

type Test struct {
	TestDefinition

	Filename string

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

	CombinedVariables map[string]string

	DbChecks []models.DatabaseCheck
}

func (*Test) AfterRequestScriptPath added in v1.7.0

func (t *Test) AfterRequestScriptPath() string

func (*Test) AfterRequestScriptTimeout added in v1.7.0

func (t *Test) AfterRequestScriptTimeout() int

func (*Test) BeforeScriptPath

func (t *Test) BeforeScriptPath() string

func (*Test) BeforeScriptTimeout

func (t *Test) BeforeScriptTimeout() int

func (*Test) Clone added in v1.0.5

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

func (*Test) ContentType added in v1.0.7

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) GetCombinedVariables added in v1.20.0

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

func (*Test) GetDatabaseChecks added in v1.18.0

func (t *Test) GetDatabaseChecks() []models.DatabaseCheck

func (*Test) GetDescription added in v1.20.0

func (t *Test) GetDescription() string

func (*Test) GetFileName added in v1.11.1

func (t *Test) GetFileName() string

func (*Test) GetForm added in v1.0.7

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 added in v1.0.5

func (t *Test) GetRequest() string

func (*Test) GetResponse

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

func (*Test) GetResponseHeaders added in v1.0.5

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

func (*Test) GetResponses added in v1.0.5

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

func (*Test) GetStatus added in v1.13.0

func (t *Test) GetStatus() string

func (*Test) GetVariables added in v1.0.5

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

func (*Test) GetVariablesToSet added in v1.0.6

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) IgnoreDbOrdering added in v1.16.0

func (t *Test) IgnoreDbOrdering() 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) SetDatabaseChecks added in v1.18.0

func (t *Test) SetDatabaseChecks(checks []models.DatabaseCheck)

func (*Test) SetDbQueryString added in v1.12.0

func (t *Test) SetDbQueryString(query string)

func (*Test) SetDbResponseJson added in v1.12.0

func (t *Test) SetDbResponseJson(responses []string)

func (*Test) SetForm added in v1.0.7

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

func (*Test) SetHeaders added in v1.0.5

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

func (*Test) SetMethod added in v1.0.5

func (t *Test) SetMethod(val string)

func (*Test) SetPath added in v1.0.5

func (t *Test) SetPath(val string)

func (*Test) SetQuery added in v1.0.5

func (t *Test) SetQuery(val string)

func (*Test) SetRequest added in v1.0.5

func (t *Test) SetRequest(val string)

func (*Test) SetResponses added in v1.0.5

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

func (*Test) SetStatus added in v1.13.0

func (t *Test) SetStatus(status 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"`
	Description              string                    `json:"description" yaml:"description"`
	Status                   string                    `json:"status" yaml:"status"`
	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       scriptParams              `json:"beforeScript" yaml:"beforeScript"`
	AfterRequestScriptParams scriptParams              `json:"afterRequestScript" yaml:"afterRequestScript"`
	HeadersVal               map[string]string         `json:"headers" yaml:"headers"`
	CookiesVal               map[string]string         `json:"cookies" yaml:"cookies"`
	Cases                    []CaseData                `json:"cases" yaml:"cases"`
	ComparisonParams         compare.Params            `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"`
	DatabaseChecks           []DatabaseCheck           `json:"dbChecks" yaml:"dbChecks"`
}

type VariablesToSet added in v1.0.6

type VariablesToSet map[int]map[string]string

func (*VariablesToSet) UnmarshalYAML added in v1.0.6

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 {
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader(testsLocation string) *YamlFileLoader

func (*YamlFileLoader) Load

func (l *YamlFileLoader) Load() ([]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