match

package
v2.3.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2018 License: MIT Imports: 8 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() *MemoryStore

NewMemoryStore is the MemoryStore contructor

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

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

type Store

type Store interface {
	Save(definition.Match)
	Reset()
	GetAll() []definition.Match
}

type Tester

type Tester struct {
	Scenario scenario.Director
}

func NewTester

func NewTester(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

Jump to

Keyboard shortcuts

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