forked from urdt/ussd
move to testutil
This commit is contained in:
parent
651969668f
commit
5692440099
24
internal/testutil/mocks/userdbmock.go
Normal file
24
internal/testutil/mocks/userdbmock.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package mocks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"git.defalsify.org/vise.git/db"
|
||||||
|
"git.grassecon.net/urdt/ussd/internal/utils"
|
||||||
|
"github.com/stretchr/testify/mock"
|
||||||
|
)
|
||||||
|
|
||||||
|
type MockUserDataStore struct {
|
||||||
|
db.Db
|
||||||
|
mock.Mock
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MockUserDataStore) ReadEntry(ctx context.Context, sessionId string, typ utils.DataTyp) ([]byte, error) {
|
||||||
|
args := m.Called(ctx, sessionId, typ)
|
||||||
|
return args.Get(0).([]byte), args.Error(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *MockUserDataStore) WriteEntry(ctx context.Context, sessionId string, typ utils.DataTyp, value []byte) error {
|
||||||
|
args := m.Called(ctx, sessionId, typ, value)
|
||||||
|
return args.Error(0)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user