Documentation ¶
Index ¶
- Variables
- type Error
- type InMemoryScenarioStore
- func (sm *InMemoryScenarioStore) GetPaused() bool
- func (sm *InMemoryScenarioStore) GetState(name string) string
- func (sm *InMemoryScenarioStore) List() string
- func (sm *InMemoryScenarioStore) Reset(name string) bool
- func (sm *InMemoryScenarioStore) ResetAll()
- func (sm *InMemoryScenarioStore) SetPaused(newstate bool)
- func (sm *InMemoryScenarioStore) SetState(name, status string)
- type InMemoryTransactionStore
- func (mrs *InMemoryTransactionStore) Get(limit int, offset int) []Transaction
- func (mrs *InMemoryTransactionStore) GetAll() []Transaction
- func (mrs *InMemoryTransactionStore) Reset()
- func (mrs *InMemoryTransactionStore) ResetMatch(req mock.Request)
- func (mrs *InMemoryTransactionStore) Save(req Transaction)
- type Matcher
- type Request
- type Result
- type ScenearioStorer
- type Spy
- func (mc Spy) Find(r mock.Request) []Transaction
- func (mc Spy) Get(limit int, offset int) []Transaction
- func (mc Spy) GetAll() []Transaction
- func (mc Spy) GetMatched() []Transaction
- func (mc Spy) GetUnMatched() []Transaction
- func (mc Spy) Reset()
- func (mc Spy) ResetMatch(r mock.Request)
- func (mc Spy) Save(match Transaction)
- type Transaction
- type TransactionSpier
- type TransactionStorer
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type InMemoryScenarioStore ¶
type InMemoryScenarioStore struct {
// contains filtered or unexported fields
}
func NewInMemoryScenarioStore ¶
func NewInMemoryScenarioStore() *InMemoryScenarioStore
func (*InMemoryScenarioStore) GetPaused ¶
func (sm *InMemoryScenarioStore) GetPaused() bool
func (*InMemoryScenarioStore) GetState ¶
func (sm *InMemoryScenarioStore) GetState(name string) string
func (*InMemoryScenarioStore) List ¶ added in v3.0.2
func (sm *InMemoryScenarioStore) List() string
func (*InMemoryScenarioStore) Reset ¶
func (sm *InMemoryScenarioStore) Reset(name string) bool
func (*InMemoryScenarioStore) ResetAll ¶
func (sm *InMemoryScenarioStore) ResetAll()
func (*InMemoryScenarioStore) SetPaused ¶
func (sm *InMemoryScenarioStore) SetPaused(newstate bool)
func (*InMemoryScenarioStore) SetState ¶
func (sm *InMemoryScenarioStore) SetState(name, status string)
type InMemoryTransactionStore ¶
InMemoryTransactionStore stores all received request and their matches in memory until the last reset
func NewInMemoryTransactionStore ¶
func NewInMemoryTransactionStore(checker Matcher, limit int) *InMemoryTransactionStore
NewInMemoryScenarioStore is the InMemoryTransactionStore constructor
func (*InMemoryTransactionStore) Get ¶
func (mrs *InMemoryTransactionStore) Get(limit int, offset int) []Transaction
Get return an subset of current matches (positive and negative) in memory
func (*InMemoryTransactionStore) GetAll ¶
func (mrs *InMemoryTransactionStore) GetAll() []Transaction
GetAll return current matches (positive and negative) in memory
func (*InMemoryTransactionStore) Reset ¶
func (mrs *InMemoryTransactionStore) Reset()
Reset clean the request stored in memory
func (*InMemoryTransactionStore) ResetMatch ¶
func (mrs *InMemoryTransactionStore) ResetMatch(req mock.Request)
ResetMatch clean the request stored in memory that matches a particular criteria
func (*InMemoryTransactionStore) Save ¶
func (mrs *InMemoryTransactionStore) Save(req Transaction)
Save store a match information
type Matcher ¶
type Matcher interface {
Match(req *mock.Request, mock *mock.Definition, scenarioAware bool) (bool, error)
}
Matcher checks if the received request matches with some specific mock request config.
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func NewTester ¶
func NewTester(comparator *payload.Comparator, scenario ScenearioStorer) *Request
type Result ¶
type Result struct { Found bool `json:"match"` URI string `json:"uri"` Errors []Error `json:"errors"` }
Result contains the match result and the failing matches with different mocks and the reason or the fail.
type ScenearioStorer ¶
type Spy ¶
type Spy struct {
// contains filtered or unexported fields
}
func NewSpy ¶
func NewSpy(checker Matcher, transactionStore TransactionStorer) *Spy
func (Spy) GetAll ¶
func (mc Spy) GetAll() []Transaction
func (Spy) GetMatched ¶
func (mc Spy) GetMatched() []Transaction
func (Spy) GetUnMatched ¶
func (mc Spy) GetUnMatched() []Transaction
func (Spy) Save ¶
func (mc Spy) Save(match Transaction)
type Transaction ¶
type Transaction struct { Time int64 `json:"time"` Request *mock.Request `json:"request"` Response *mock.Response `json:"response"` Result *Result `json:"result"` }
Transaction contains the whole information about the request match. The http request, the final response received and the matching result.
func NewTransaction ¶
type TransactionSpier ¶
type TransactionSpier interface { Find(mock.Request) []Transaction GetMatched() []Transaction GetUnMatched() []Transaction TransactionStorer }
type TransactionStorer ¶
type TransactionStorer interface { Save(Transaction) Reset() ResetMatch(mock.Request) GetAll() []Transaction Get(limit int, offset int) []Transaction }