mock

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssertConfig

type AssertConfig struct {
	Route  string         `json:"route"`
	Nth    int            `json:"nth"`
	Assert *AssertOptions `json:"assert"`
}

type AssertHeader

type AssertHeader map[string][]string

type AssertOptions

type AssertOptions struct {
	Type      AssertType             `json:"type"`
	Data      map[string]interface{} `json:"data"`
	KeyValues map[string]interface{} `json:"key_values"`
	Key       string                 `json:"key"`
	Value     string                 `json:"value"`
	And       *AssertOptions         `json:"and"`
	Or        *AssertOptions         `json:"or"`
}

type AssertResponse

type AssertResponse struct {
	ValidationErrors []ValidationError `json:"validation_errors"`
}

type AssertType

type AssertType int
const (
	AssertType_None AssertType = iota
	AssertType_HeaderMatch
	AssertType_MethodMatch
	AssertType_JsonBodyMatch
	AssertType_FormMatch
	AssertType_QuerystringMatch
	AssertType_QuerystringExactMatch
)

func (*AssertType) MarshalJSON

func (this *AssertType) MarshalJSON() ([]byte, error)

func (*AssertType) UnmarshalJSON

func (this *AssertType) UnmarshalJSON(data []byte) error

type MockConfig

type MockConfig struct {
	Url string
}

func Init

func Init(url string) *MockConfig

type ValidationError

type ValidationError struct {
	Code     ValidationErrorCode `json:"code"`
	Metadata map[string]string   `json:"metadata"`
}

func Assert

func Assert(config *MockConfig, assertConfig *AssertConfig) ([]ValidationError, error)

type ValidationErrorCode

type ValidationErrorCode int
const (
	ValidationErrorCode_Unknown ValidationErrorCode = iota
	ValidationErrorCode_NoCall
	ValidationErrorCode_MethodMismatch
	ValidationErrorCode_HeaderNotIncluded
	ValidationErrorCode_HeaderValueMismatch
	ValidationErrorCode_BodyMismatch
	ValidationErrorCode_RequestHasNoBodyContent
	ValidationErrorCode_FormKeyDoesNotExist
	ValidationErrorCode_FormValueMismatch
	ValidationErrorCode_NthOutOfRange
	ValidationErrorCode_RequestHasNoQuerystring
	ValidationErrorCode_QuerystringMismatch
	ValidationErrorCode_QuerystringKeyNotSet
)

func (*ValidationErrorCode) MarshalJSON

func (this *ValidationErrorCode) MarshalJSON() ([]byte, error)

func (*ValidationErrorCode) UnmarshalJSON

func (this *ValidationErrorCode) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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