Add voucherlist check in test

This commit is contained in:
lash 2024-11-03 15:37:46 +00:00
parent da46b6ca1a
commit 984f50f905
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746

View File

@ -15,6 +15,7 @@ import (
"git.grassecon.net/urdt/ussd/config" "git.grassecon.net/urdt/ussd/config"
"git.grassecon.net/urdt/ussd/models" "git.grassecon.net/urdt/ussd/models"
"git.grassecon.net/term/lookup" "git.grassecon.net/term/lookup"
"git.grassecon.net/term/event"
) )
func init() { func init() {
@ -200,8 +201,18 @@ func TestHandleMsg(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
if len(v) == 0 { if !bytes.Contains(v, []byte("abcdef")) {
t.Fatal("no transaction data") t.Fatal("no transaction data")
} }
t.Logf("tx %s", v)
userDb.SetPrefix(event.DATATYPE_USERSUB)
userDb.SetSession(aliceSession)
k := append([]byte("vouchers"), []byte("sym")...)
v, err = userDb.Get(ctx, k)
if err != nil {
t.Fatal(err)
}
if !bytes.Contains(v, []byte("1:FOO")) {
t.Fatalf("expected '1:FOO', got %s", v)
}
} }