forked from urdt/ussd
Use the DATATYPE_USERDATA as the prefix for the NewSubPrefixDb func
This commit is contained in:
parent
a659fb06fa
commit
589a94216b
@ -8,6 +8,7 @@ import (
|
|||||||
"github.com/alecthomas/assert/v2"
|
"github.com/alecthomas/assert/v2"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
visedb "git.defalsify.org/vise.git/db"
|
||||||
memdb "git.defalsify.org/vise.git/db/mem"
|
memdb "git.defalsify.org/vise.git/db/mem"
|
||||||
"git.grassecon.net/urdt/ussd/internal/storage"
|
"git.grassecon.net/urdt/ussd/internal/storage"
|
||||||
dataserviceapi "github.com/grassrootseconomics/ussd-data-service/pkg/api"
|
dataserviceapi "github.com/grassrootseconomics/ussd-data-service/pkg/api"
|
||||||
@ -83,7 +84,9 @@ func TestGetVoucherData(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
spdb := storage.NewSubPrefixDb(db, []byte("vouchers"))
|
|
||||||
|
prefix := IntToBytes(visedb.DATATYPE_USERDATA)
|
||||||
|
spdb := storage.NewSubPrefixDb(db, prefix)
|
||||||
|
|
||||||
// Test voucher data
|
// Test voucher data
|
||||||
mockData := map[DataTyp][]byte{
|
mockData := map[DataTyp][]byte{
|
||||||
|
@ -85,8 +85,10 @@ func NewHandlers(appFlags *asm.FlagParser, userdataStore db.Db, adminstore *util
|
|||||||
userDb := &common.UserDataStore{
|
userDb := &common.UserDataStore{
|
||||||
Db: userdataStore,
|
Db: userdataStore,
|
||||||
}
|
}
|
||||||
// Instantiate the SubPrefixDb with "vouchers" prefix
|
|
||||||
prefixDb := storage.NewSubPrefixDb(userdataStore, []byte("vouchers"))
|
// Instantiate the SubPrefixDb with "DATATYPE_USERDATA" prefix
|
||||||
|
prefix := common.IntToBytes(db.DATATYPE_USERDATA)
|
||||||
|
prefixDb := storage.NewSubPrefixDb(userdataStore, prefix)
|
||||||
|
|
||||||
h := &Handlers{
|
h := &Handlers{
|
||||||
userdataStore: userDb,
|
userdataStore: userDb,
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
testdataloader "github.com/peteole/testdata-loader"
|
testdataloader "github.com/peteole/testdata-loader"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
visedb "git.defalsify.org/vise.git/db"
|
||||||
memdb "git.defalsify.org/vise.git/db/mem"
|
memdb "git.defalsify.org/vise.git/db/mem"
|
||||||
dataserviceapi "github.com/grassrootseconomics/ussd-data-service/pkg/api"
|
dataserviceapi "github.com/grassrootseconomics/ussd-data-service/pkg/api"
|
||||||
)
|
)
|
||||||
@ -56,7 +57,8 @@ func InitializeTestSubPrefixDb(t *testing.T, ctx context.Context) *storage.SubPr
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
spdb := storage.NewSubPrefixDb(db, []byte("vouchers"))
|
prefix := common.IntToBytes(visedb.DATATYPE_USERDATA)
|
||||||
|
spdb := storage.NewSubPrefixDb(db, prefix)
|
||||||
|
|
||||||
return spdb
|
return spdb
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user