Files
play-with-docker/storage/mock.go
Jonathan Leibiusky @xetorthio 0e08107738 Tests are working again
2017-07-28 20:42:05 -03:00

56 lines
1.3 KiB
Go

package storage
import (
"github.com/play-with-docker/play-with-docker/pwd/types"
"github.com/stretchr/testify/mock"
)
type Mock struct {
mock.Mock
}
func (m *Mock) SessionGet(sessionId string) (*types.Session, error) {
args := m.Called(sessionId)
return args.Get(0).(*types.Session), args.Error(1)
}
func (m *Mock) SessionPut(session *types.Session) error {
args := m.Called(session)
return args.Error(0)
}
func (m *Mock) SessionCount() (int, error) {
args := m.Called()
return args.Int(0), args.Error(1)
}
func (m *Mock) SessionDelete(sessionId string) error {
args := m.Called(sessionId)
return args.Error(0)
}
func (m *Mock) SessionGetAll() (map[string]*types.Session, error) {
args := m.Called()
return args.Get(0).(map[string]*types.Session), args.Error(1)
}
func (m *Mock) InstanceFind(sessionId, ip string) (*types.Instance, error) {
args := m.Called(sessionId, ip)
return args.Get(0).(*types.Instance), args.Error(1)
}
func (m *Mock) InstanceCreate(sessionId string, instance *types.Instance) error {
args := m.Called(sessionId, instance)
return args.Error(0)
}
func (m *Mock) InstanceDelete(sessionId, instanceName string) error {
args := m.Called(sessionId, instanceName)
return args.Error(0)
}
func (m *Mock) InstanceCount() (int, error) {
args := m.Called()
return args.Int(0), args.Error(1)
}