match

package
v2.5.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCookiesNotMatch  = errors.New("Cookies not match")
	ErrScenarioNotMatch = errors.New("Scenario state not match")
	ErrPathNotMatch     = errors.New("Path not match")
)

Functions

This section is empty.

Types

type Checker

type Checker interface {
	Check(req *definition.Request, mock *definition.Mock, scenarioAware bool) (bool, error)
}

Checker checks if the received request matches with some specific mock request definition.

type MemoryStore

type MemoryStore struct {
	sync.Mutex
	// contains filtered or unexported fields
}

MemoryStore stores all received request and their matches in memory until the last reset

func NewMemoryStore

func NewMemoryStore(checker Checker) *MemoryStore

NewMemoryStore is the MemoryStore constructor

func (*MemoryStore) Get

func (mrs *MemoryStore) Get(limit uint, offset uint) []definition.Match

Get return an subset of current matches (positive and negative) in memory

func (*MemoryStore) GetAll

func (mrs *MemoryStore) GetAll() []definition.Match

GetAll return current matches (positive and negative) in memory

func (*MemoryStore) Reset

func (mrs *MemoryStore) Reset()

Reset clean the request stored in memory

func (*MemoryStore) ResetMatch

func (mrs *MemoryStore) ResetMatch(req definition.Request)

ResetMatch clean the request stored in memory that matches a particular criteria

func (*MemoryStore) Save

func (mrs *MemoryStore) Save(req definition.Match)

Save store a match information

type Spier

type Spier interface {
	Find(definition.Request) []definition.Match
	GetMatched() []definition.Match
	GetUnMatched() []definition.Match
	Store
}

type Spy

type Spy struct {
	// contains filtered or unexported fields
}

func NewSpy

func NewSpy(checker Checker, matchStore Store) *Spy

func (Spy) Find

func (mc Spy) Find(r definition.Request) []definition.Match

func (Spy) Get

func (mc Spy) Get(limit uint, offset uint) []definition.Match

func (Spy) GetAll

func (mc Spy) GetAll() []definition.Match

func (Spy) GetMatched

func (mc Spy) GetMatched() []definition.Match

func (Spy) GetUnMatched

func (mc Spy) GetUnMatched() []definition.Match

func (Spy) Reset

func (mc Spy) Reset()

func (Spy) ResetMatch

func (mc Spy) ResetMatch(r definition.Request)

ResetMatch ...

func (Spy) Save

func (mc Spy) Save(match definition.Match)

type Store

type Store interface {
	Save(definition.Match)
	Reset()
	ResetMatch(definition.Request)
	GetAll() []definition.Match
	Get(limit uint, offset uint) []definition.Match
}

type Tester

type Tester struct {
	// contains filtered or unexported fields
}

func NewTester

func NewTester(comparator *payload.Comparator, scenario scenario.Director) *Tester

func (Tester) Check

func (mm Tester) Check(req *definition.Request, mock *definition.Mock, scenarioAware bool) (bool, error)

func (Tester) ValuesToString

func (mm Tester) ValuesToString(values definition.Values) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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