Compare commits

...

2 Commits

View File

@ -2124,20 +2124,19 @@ func TestCheckVouchers(t *testing.T) {
func TestGetVoucherList(t *testing.T) { func TestGetVoucherList(t *testing.T) {
sessionId := "session123" sessionId := "session123"
ctx := context.WithValue(context.Background(), "SessionId", sessionId) ctx, store := InitializeTestStore(t)
ctx = context.WithValue(ctx, "SessionId", sessionId)
spdb := InitializeTestSubPrefixDb(t, ctx)
// Initialize MenuHandlers // Initialize MenuHandlers
h := &MenuHandlers{ h := &MenuHandlers{
prefixDb: spdb, userdataStore: store,
ReplaceSeparatorFunc: mockReplaceSeparator, ReplaceSeparatorFunc: mockReplaceSeparator,
} }
mockSyms := []byte("1:SRF\n2:MILO") mockSyms := []byte("1:SRF\n2:MILO")
// Put voucher sym data from the store // Put voucher sym data from the store
err := spdb.Put(ctx, storedb.ToBytes(storedb.DATA_VOUCHER_SYMBOLS), mockSyms) err := store.WriteEntry(ctx, sessionId, storedb.DATA_VOUCHER_SYMBOLS, mockSyms)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -2157,15 +2156,11 @@ func TestViewVoucher(t *testing.T) {
} }
ctx, store := InitializeTestStore(t) ctx, store := InitializeTestStore(t)
sessionId := "session123" sessionId := "session123"
ctx = context.WithValue(ctx, "SessionId", sessionId) ctx = context.WithValue(ctx, "SessionId", sessionId)
spdb := InitializeTestSubPrefixDb(t, ctx)
h := &MenuHandlers{ h := &MenuHandlers{
userdataStore: store, userdataStore: store,
flagManager: fm, flagManager: fm,
prefixDb: spdb,
} }
// Define mock voucher data // Define mock voucher data
@ -2178,7 +2173,7 @@ func TestViewVoucher(t *testing.T) {
// Put the data // Put the data
for key, value := range mockData { for key, value := range mockData {
err = spdb.Put(ctx, []byte(storedb.ToBytes(key)), []byte(value)) err := store.WriteEntry(ctx, sessionId, key, []byte(value))
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }