From 5692440099109d321a7a8487407b82fcd6cb561c Mon Sep 17 00:00:00 2001 From: Carlosokumu Date: Thu, 24 Oct 2024 12:05:27 +0300 Subject: [PATCH] move to testutil --- internal/testutil/mocks/userdbmock.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 internal/testutil/mocks/userdbmock.go diff --git a/internal/testutil/mocks/userdbmock.go b/internal/testutil/mocks/userdbmock.go new file mode 100644 index 0000000..ff3f18d --- /dev/null +++ b/internal/testutil/mocks/userdbmock.go @@ -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) +}