Documentation ¶
Overview ¶
Package mocks contains code to mock an external service via an *http.Client and generated code for mocking *storage.Instance.
Index ¶
- func NewMockedService(handler http.Handler) *http.Client
- type MockStorageInstance
- func (_m *MockStorageInstance) GetOrder(ctx context.Context, id string) (storage.Order, error)
- func (_m *MockStorageInstance) GetOrders(ctx context.Context, status storage.OrderStatus) ([]storage.Order, error)
- func (_m *MockStorageInstance) InsertOrder(ctx context.Context, order storage.Order) (string, error)
- func (_m *MockStorageInstance) SetOrderStatus(ctx context.Context, id string, status storage.OrderStatus) error
- type StorageInstance
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MockStorageInstance ¶
MockStorageInstance is an autogenerated mock type for the StorageInstance type
func (*MockStorageInstance) GetOrders ¶
func (_m *MockStorageInstance) GetOrders(ctx context.Context, status storage.OrderStatus) ([]storage.Order, error)
GetOrders provides a mock function with given fields: ctx, status
func (*MockStorageInstance) InsertOrder ¶
func (_m *MockStorageInstance) InsertOrder(ctx context.Context, order storage.Order) (string, error)
InsertOrder provides a mock function with given fields: ctx, order
func (*MockStorageInstance) SetOrderStatus ¶
func (_m *MockStorageInstance) SetOrderStatus(ctx context.Context, id string, status storage.OrderStatus) error
SetOrderStatus provides a mock function with given fields: ctx, id, status
type StorageInstance ¶
type StorageInstance interface { // GetOrder should return the order with the given ID. If that ID isn't found then // the special ErrOrderNotFound error should be returned. GetOrder(ctx context.Context, id string) (storage.Order, error) // GetOrders should return all orders with the given status. If status is the // special -1 value then it should return all orders regardless of their status. GetOrders(ctx context.Context, status storage.OrderStatus) ([]storage.Order, error) // SetOrderStatus should update the order with the given ID and set the status // field. If that ID isn't found then the special ErrOrderNotFound error should // be returned. SetOrderStatus(ctx context.Context, id string, status storage.OrderStatus) error // InsertOrder should fill in the order's ID with a unique identifier if it's not // already set and then insert it into the database. It should return the order's // ID. If the order already exists then ErrOrderExists should be returned. InsertOrder(ctx context.Context, order storage.Order) (string, error) }
StorageInstance allows us to mock *storage.Instance in the api package
Click to show internal directories.
Click to hide internal directories.