ussd/internal/mocks/userdbmock.go

25 lines
596 B
Go
Raw Permalink Normal View History

2024-09-09 16:15:35 +02:00
package mocks
import (
"context"
2024-09-10 10:24:09 +02:00
"git.defalsify.org/vise.git/db"
2024-09-09 16:15:35 +02:00
"git.grassecon.net/urdt/ussd/internal/utils"
"github.com/stretchr/testify/mock"
)
type MockUserDataStore struct {
2024-09-10 10:24:09 +02:00
db.Db
2024-09-09 16:15:35 +02:00
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)
}