Available on crate feature
mocks only.Expand description
An interface for mocking Redis commands.
There are several patterns for utilizing a mocking layer in tests. In some cases a simple “echo” interface is enough, or in others callers may need to buffer a series of commands before performing any assertions, etc. More complicated test scenarios may require storing and operating on real values.
This interface exposes several interfaces and structs for supporting the above use cases:
Echo- A simple mocking struct that returns the provided arguments back to the caller.SimpleMap- A mocking struct that implements the basicGET,SET, andDELcommands.Buffer- A mocking struct that buffers commands internally, returningQUEUEDto each command. Callers can then drain or inspect the buffer later.
The base Mocks trait is directly exposed so callers can implement their own mocking layer as well.
Structs§
- A mocking layer that buffers the commands internally and returns
QUEUEDto the caller. - An implementation of a mocking layer that returns the provided arguments to the caller.
- A wrapper type for the parts of an internal Redis command.
- A struct that implements some of the basic mapping functions. If callers require a mocking layer that stores and operates on real values then this struct is a good place to start.
Traits§
- An interface for intercepting and processing Redis commands in a mocking layer.