ussd/internal/testutil/mocks/userdbmock.go

25 lines
590 B
Go
Raw Normal View History

2024-10-24 11:05:27 +02:00
package mocks
import (
"context"
"git.defalsify.org/vise.git/db"
2024-10-30 02:28:55 +01:00
"git.grassecon.net/urdt/ussd/common"
2024-10-24 11:05:27 +02:00
"github.com/stretchr/testify/mock"
)
type MockUserDataStore struct {
db.Db
mock.Mock
}
2024-10-30 02:28:55 +01:00
func (m *MockUserDataStore) ReadEntry(ctx context.Context, sessionId string, typ common.DataTyp) ([]byte, error) {
2024-10-24 11:05:27 +02:00
args := m.Called(ctx, sessionId, typ)
return args.Get(0).([]byte), args.Error(1)
}
2024-10-30 02:28:55 +01:00
func (m *MockUserDataStore) WriteEntry(ctx context.Context, sessionId string, typ common.DataTyp, value []byte) error {
2024-10-24 11:05:27 +02:00
args := m.Called(ctx, sessionId, typ, value)
return args.Error(0)
}