yaml_file

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 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

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

func (t *Test) AfterRequestScriptPath() string

func (*Test) AfterRequestScriptTimeout

func (t *Test) AfterRequestScriptTimeout() int

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) GetCombinedVariables

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

func (*Test) GetDatabaseChecks

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

func (*Test) GetDescription

func (t *Test) GetDescription() string

func (*Test) GetFileName

func (t *Test) GetFileName() 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) GetStatus

func (t *Test) GetStatus() 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) IgnoreDbOrdering

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

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

func (*Test) SetDbQueryString

func (t *Test) SetDbQueryString(query string)

func (*Test) SetDbResponseJson

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

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) SetStatus

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.CompareParams     `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

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 {
	// 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