From d9438cb8156d687826a54d02ac5da96ab3893340 Mon Sep 17 00:00:00 2001 From: lash Date: Tue, 14 Jan 2025 07:39:52 +0000 Subject: [PATCH] Move api mocks out to sarafu-api --- event/custodial_test.go | 10 +++---- event/nats/nats_test.go | 23 ++++++++-------- event/token_test.go | 43 +++++++++++++++-------------- go.mod | 7 ++++- go.sum | 12 ++++++-- internal/testutil/api.go | 59 ---------------------------------------- 6 files changed, 55 insertions(+), 99 deletions(-) delete mode 100644 internal/testutil/api.go diff --git a/event/custodial_test.go b/event/custodial_test.go index b0de43d..4683cf6 100644 --- a/event/custodial_test.go +++ b/event/custodial_test.go @@ -12,8 +12,8 @@ import ( "git.grassecon.net/grassrootseconomics/sarafu-vise-events/config" "git.grassecon.net/grassrootseconomics/common/hex" storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db" - "git.grassecon.net/grassrootseconomics/sarafu-vise-events/internal/testutil" apievent "git.grassecon.net/grassrootseconomics/sarafu-api/event" + apimocks "git.grassecon.net/grassrootseconomics/sarafu-api/testutil/mocks" viseevent "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/event" ) @@ -28,14 +28,14 @@ func TestCustodialRegistration(t *testing.T) { storageService := mocks.NewMemStorageService(ctx) userDb := storageService.Db - alice, err := hex.NormalizeHex(testutil.AliceChecksum) + alice, err := hex.NormalizeHex(apimocks.AliceChecksum) if err != nil { t.Fatal(err) } userDb.SetSession(alice) userDb.SetPrefix(db.DATATYPE_USERDATA) - err = userDb.Put(ctx, storedb.PackKey(storedb.DATA_PUBLIC_KEY_REVERSE, []byte{}), []byte(testutil.AliceSession)) + err = userDb.Put(ctx, storedb.PackKey(storedb.DATA_PUBLIC_KEY_REVERSE, []byte{}), []byte(apimocks.AliceSession)) if err != nil { t.Fatal(err) } @@ -44,13 +44,13 @@ func TestCustodialRegistration(t *testing.T) { ca := cache.NewCache() pr, _ := storageService.GetPersister(ctx) pr = pr.WithContent(st, ca) - err = pr.Save(testutil.AliceSession) + err = pr.Save(apimocks.AliceSession) if err != nil { t.Fatal(err) } ev := &apievent.EventCustodialRegistration{ - Account: testutil.AliceChecksum, + Account: apimocks.AliceChecksum, } // Use dev service or mock service instead diff --git a/event/nats/nats_test.go b/event/nats/nats_test.go index dada6f0..6eac4f2 100644 --- a/event/nats/nats_test.go +++ b/event/nats/nats_test.go @@ -19,6 +19,7 @@ import ( "git.grassecon.net/grassrootseconomics/sarafu-api/models" "git.grassecon.net/grassrootseconomics/sarafu-vise-events/lookup" "git.grassecon.net/grassrootseconomics/common/hex" + apimocks "git.grassecon.net/grassrootseconomics/sarafu-api/testutil/mocks" "git.grassecon.net/grassrootseconomics/sarafu-vise-events/internal/testutil" "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/application" viseevent "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/event" @@ -97,11 +98,11 @@ func TestHandleMsg(t *testing.T) { t.Fatal(err) } - api := &testutil.MockApi{} + api := &apimocks.MockApi{} api.TransactionsContent = []dataserviceapi.Last10TxResponse{ dataserviceapi.Last10TxResponse{ - Sender: testutil.AliceChecksum, - Recipient: testutil.BobChecksum, + Sender: apimocks.AliceChecksum, + Recipient: apimocks.BobChecksum, TransferValue: strconv.Itoa(txValue), ContractAddress: tokenAddress, TxHash: txHash, @@ -131,14 +132,14 @@ func TestHandleMsg(t *testing.T) { eu := viseevent.NewEventsUpdater(api, storageService) userDb := storageService.Db - alice, err := hex.NormalizeHex(testutil.AliceChecksum) + alice, err := hex.NormalizeHex(apimocks.AliceChecksum) if err != nil { t.Fatal(err) } userDb.SetSession(alice) userDb.SetPrefix(db.DATATYPE_USERDATA) - err = userDb.Put(ctx, storedb.PackKey(storedb.DATA_PUBLIC_KEY_REVERSE, []byte{}), []byte(testutil.AliceSession)) + err = userDb.Put(ctx, storedb.PackKey(storedb.DATA_PUBLIC_KEY_REVERSE, []byte{}), []byte(apimocks.AliceSession)) if err != nil { t.Fatal(err) } @@ -159,7 +160,7 @@ func TestHandleMsg(t *testing.T) { "to": "%s", "value": "%d" } -}`, txBlock, tokenAddress, txTimestamp, txHash, testutil.AliceChecksum, testutil.BobChecksum, txValue) +}`, txBlock, tokenAddress, txTimestamp, txHash, apimocks.AliceChecksum, apimocks.BobChecksum, txValue) msg := &testMsg{ data: []byte(data), } @@ -168,7 +169,7 @@ func TestHandleMsg(t *testing.T) { userStore := store.UserDataStore{ Db: userDb, } - v, err := userStore.ReadEntry(ctx, testutil.AliceSession, storedb.DATA_ACTIVE_SYM) + v, err := userStore.ReadEntry(ctx, apimocks.AliceSession, storedb.DATA_ACTIVE_SYM) if err != nil { t.Fatal(err) } @@ -176,7 +177,7 @@ func TestHandleMsg(t *testing.T) { t.Fatalf("expected '%s', got %s", tokenSymbol, v) } - v, err = userStore.ReadEntry(ctx, testutil.AliceSession, storedb.DATA_ACTIVE_BAL) + v, err = userStore.ReadEntry(ctx, apimocks.AliceSession, storedb.DATA_ACTIVE_BAL) if err != nil { t.Fatal(err) } @@ -187,7 +188,7 @@ func TestHandleMsg(t *testing.T) { t.Fatalf("expected '%d', got %s", tokenBalance, v) } - v, err = userStore.ReadEntry(ctx, testutil.AliceSession, storedb.DATA_TRANSACTIONS) + v, err = userStore.ReadEntry(ctx, apimocks.AliceSession, storedb.DATA_TRANSACTIONS) if err != nil { t.Fatal(err) } @@ -200,7 +201,7 @@ func TestHandleMsg(t *testing.T) { if err != nil { t.Fatal(err) } - ctx = context.WithValue(ctx, "SessionId", testutil.AliceSession) + ctx = context.WithValue(ctx, "SessionId", apimocks.AliceSession) rrs, err := mh.GetVoucherList(ctx, "", []byte{}) if err != nil { t.Fatal(err) @@ -210,7 +211,7 @@ func TestHandleMsg(t *testing.T) { t.Fatalf("expected '%v', got '%v'", expect, rrs.Content) } // userDb.SetPrefix(event.DATATYPE_USERSUB) -// userDb.SetSession(testutil.AliceSession) +// userDb.SetSession(apimocks.AliceSession) // k := append([]byte("vouchers"), []byte("sym")...) // v, err = userDb.Get(ctx, k) // if err != nil { diff --git a/event/token_test.go b/event/token_test.go index 5263190..4d66364 100644 --- a/event/token_test.go +++ b/event/token_test.go @@ -20,6 +20,7 @@ import ( "git.grassecon.net/grassrootseconomics/common/hex" "git.grassecon.net/grassrootseconomics/sarafu-vise-events/internal/testutil" apievent "git.grassecon.net/grassrootseconomics/sarafu-api/event" + apimocks "git.grassecon.net/grassrootseconomics/sarafu-api/testutil/mocks" viseevent "git.grassecon.net/grassrootseconomics/sarafu-vise/handlers/event" "git.grassecon.net/grassrootseconomics/visedriver/testutil/mocks" ) @@ -45,11 +46,11 @@ func TestTokenTransfer(t *testing.T) { t.Fatal(err) } - api := &testutil.MockApi{} + api := &apimocks.MockApi{} api.TransactionsContent = []dataserviceapi.Last10TxResponse{ dataserviceapi.Last10TxResponse{ - Sender: testutil.AliceChecksum, - Recipient: testutil.BobChecksum, + Sender: apimocks.AliceChecksum, + Recipient: apimocks.BobChecksum, TransferValue: strconv.Itoa(txValue), ContractAddress: tokenAddress, TxHash: txHash, @@ -80,7 +81,7 @@ func TestTokenTransfer(t *testing.T) { eu := viseevent.NewEventsUpdater(api, storageService) userDb := storageService.Db - alice, err := hex.NormalizeHex(testutil.AliceChecksum) + alice, err := hex.NormalizeHex(apimocks.AliceChecksum) if err != nil { t.Fatal(err) } @@ -88,7 +89,7 @@ func TestTokenTransfer(t *testing.T) { // TODO: deduplicate test setup userDb.SetSession(alice) userDb.SetPrefix(db.DATATYPE_USERDATA) - err = userDb.Put(ctx, storedb.PackKey(storedb.DATA_PUBLIC_KEY_REVERSE, []byte{}), []byte(testutil.AliceSession)) + err = userDb.Put(ctx, storedb.PackKey(storedb.DATA_PUBLIC_KEY_REVERSE, []byte{}), []byte(apimocks.AliceSession)) if err != nil { t.Fatal(err) } @@ -97,8 +98,8 @@ func TestTokenTransfer(t *testing.T) { } ev := &apievent.EventTokenTransfer{ - From: testutil.BobChecksum, - To: testutil.AliceChecksum, + From: apimocks.BobChecksum, + To: apimocks.AliceChecksum, Value: txValue, } @@ -108,7 +109,7 @@ func TestTokenTransfer(t *testing.T) { t.Fatal(err) } - v, err := userStore.ReadEntry(ctx, testutil.AliceSession, storedb.DATA_ACTIVE_SYM) + v, err := userStore.ReadEntry(ctx, apimocks.AliceSession, storedb.DATA_ACTIVE_SYM) if err != nil { t.Fatal(err) } @@ -116,7 +117,7 @@ func TestTokenTransfer(t *testing.T) { t.Fatalf("expected '%s', got %s", tokenSymbol, v) } - v, err = userStore.ReadEntry(ctx, testutil.AliceSession, storedb.DATA_ACTIVE_BAL) + v, err = userStore.ReadEntry(ctx, apimocks.AliceSession, storedb.DATA_ACTIVE_BAL) if err != nil { t.Fatal(err) } @@ -127,7 +128,7 @@ func TestTokenTransfer(t *testing.T) { t.Fatalf("expected '%s', got %s", expect, v) } - v, err = userStore.ReadEntry(ctx, testutil.AliceSession, storedb.DATA_TRANSACTIONS) + v, err = userStore.ReadEntry(ctx, apimocks.AliceSession, storedb.DATA_TRANSACTIONS) if err != nil { t.Fatal(err) } @@ -139,7 +140,7 @@ func TestTokenTransfer(t *testing.T) { if err != nil { t.Fatal(err) } - ctx = context.WithValue(ctx, "SessionId", testutil.AliceSession) + ctx = context.WithValue(ctx, "SessionId", apimocks.AliceSession) rrs, err := mh.GetVoucherList(ctx, "", []byte{}) if err != nil { t.Fatal(err) @@ -156,11 +157,11 @@ func TestTokenMint(t *testing.T) { t.Fatal(err) } - api := &testutil.MockApi{} + api := &apimocks.MockApi{} api.TransactionsContent = []dataserviceapi.Last10TxResponse{ dataserviceapi.Last10TxResponse{ - Sender: testutil.AliceChecksum, - Recipient: testutil.BobChecksum, + Sender: apimocks.AliceChecksum, + Recipient: apimocks.BobChecksum, TransferValue: strconv.Itoa(txValue), ContractAddress: tokenAddress, TxHash: txHash, @@ -192,14 +193,14 @@ func TestTokenMint(t *testing.T) { eu := viseevent.NewEventsUpdater(api, storageService) userDb := storageService.Db - alice, err := hex.NormalizeHex(testutil.AliceChecksum) + alice, err := hex.NormalizeHex(apimocks.AliceChecksum) if err != nil { t.Fatal(err) } userDb.SetSession(alice) userDb.SetPrefix(db.DATATYPE_USERDATA) - err = userDb.Put(ctx, storedb.PackKey(storedb.DATA_PUBLIC_KEY_REVERSE, []byte{}), []byte(testutil.AliceSession)) + err = userDb.Put(ctx, storedb.PackKey(storedb.DATA_PUBLIC_KEY_REVERSE, []byte{}), []byte(apimocks.AliceSession)) if err != nil { t.Fatal(err) } @@ -208,7 +209,7 @@ func TestTokenMint(t *testing.T) { } ev := &apievent.EventTokenMint{ - To: testutil.AliceChecksum, + To: apimocks.AliceChecksum, Value: txValue, } @@ -218,7 +219,7 @@ func TestTokenMint(t *testing.T) { t.Fatal(err) } - v, err := userStore.ReadEntry(ctx, testutil.AliceSession, storedb.DATA_ACTIVE_SYM) + v, err := userStore.ReadEntry(ctx, apimocks.AliceSession, storedb.DATA_ACTIVE_SYM) if err != nil { t.Fatal(err) } @@ -226,7 +227,7 @@ func TestTokenMint(t *testing.T) { t.Fatalf("expected '%s', got %s", tokenSymbol, v) } - v, err = userStore.ReadEntry(ctx, testutil.AliceSession, storedb.DATA_ACTIVE_BAL) + v, err = userStore.ReadEntry(ctx, apimocks.AliceSession, storedb.DATA_ACTIVE_BAL) if err != nil { t.Fatal(err) } @@ -237,7 +238,7 @@ func TestTokenMint(t *testing.T) { t.Fatalf("expected '%d', got %s", tokenBalance, v) } - v, err = userStore.ReadEntry(ctx, testutil.AliceSession, storedb.DATA_TRANSACTIONS) + v, err = userStore.ReadEntry(ctx, apimocks.AliceSession, storedb.DATA_TRANSACTIONS) if err != nil { t.Fatal(err) } @@ -249,7 +250,7 @@ func TestTokenMint(t *testing.T) { if err != nil { t.Fatal(err) } - ctx = context.WithValue(ctx, "SessionId", testutil.AliceSession) + ctx = context.WithValue(ctx, "SessionId", apimocks.AliceSession) rrs, err := mh.GetVoucherList(ctx, "", []byte{}) if err != nil { t.Fatal(err) diff --git a/go.mod b/go.mod index 2d964d0..e4c4900 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.23.4 require ( git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d git.grassecon.net/grassrootseconomics/common v0.0.0-20250113174703-6afccefd1f05 - git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250113213645-7c697394b5e7 + git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250114072912-a4976e6c52a0 git.grassecon.net/grassrootseconomics/sarafu-vise v0.0.0-20250114070250-ce9a263b40a3 git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250113213325-5228aef0889b github.com/grassrootseconomics/eth-tracker v1.3.0-rc @@ -16,6 +16,7 @@ require ( require ( github.com/alecthomas/participle/v2 v2.0.0 // indirect github.com/barbashov/iso639-3 v0.0.0-20211020172741-1f4ffb2d8d1c // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/fxamacker/cbor/v2 v2.4.0 // indirect github.com/grassrootseconomics/eth-custodial v1.3.0-beta // indirect github.com/graygnuorg/go-gdbm v0.0.0-20220711140707-71387d66dce4 // indirect @@ -28,10 +29,14 @@ require ( github.com/mattn/kinako v0.0.0-20170717041458-332c0a7e205a // indirect github.com/nats-io/nkeys v0.4.7 // indirect github.com/nats-io/nuid v1.0.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/stretchr/objx v0.5.2 // indirect + github.com/stretchr/testify v1.9.0 // indirect github.com/x448/float16 v0.8.4 // indirect golang.org/x/crypto v0.32.0 // indirect golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect gopkg.in/leonelquinteros/gotext.v1 v1.3.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index e95734a..9e797e6 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d h1:bPAOVZOX4frSG git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d/go.mod h1:jyBMe1qTYUz3mmuoC9JQ/TvFeW0vTanCUcPu3H8p4Ck= git.grassecon.net/grassrootseconomics/common v0.0.0-20250113174703-6afccefd1f05 h1:BenzGx6aDHKDwE23/mWIFD2InYIXyzHroZWV3MF5WUk= git.grassecon.net/grassrootseconomics/common v0.0.0-20250113174703-6afccefd1f05/go.mod h1:wgQJZGIS6QuNLHqDhcsvehsbn5PvgV7aziRebMnJi60= -git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250113213645-7c697394b5e7 h1:P+Bi5jcQbnCrLnKNC5k8XDTBsocyZTVifqDyZY6d0w8= -git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250113213645-7c697394b5e7/go.mod h1:X9aQF93xw3vcW2QftJfzLewvbotRM0U00DRtdmFw294= +git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250114072912-a4976e6c52a0 h1:qsZS8TPzmq/5CslDUNld6vgZr9etbWk3Lw5qYauzPbk= +git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250114072912-a4976e6c52a0/go.mod h1:X9aQF93xw3vcW2QftJfzLewvbotRM0U00DRtdmFw294= git.grassecon.net/grassrootseconomics/sarafu-vise v0.0.0-20250114070250-ce9a263b40a3 h1:E4TKaXKJbPKbN6UtbqaJbB90aSo64FzwgOhZV9n3XKI= git.grassecon.net/grassrootseconomics/sarafu-vise v0.0.0-20250114070250-ce9a263b40a3/go.mod h1:1WryKcUnFI1J4Jl3wZJ4DX/7lnew+0PDY8xWvqc46UI= git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250113213325-5228aef0889b h1:6SieNUSEKbkjzquuwazs/lVG56zdEWF10zQQEMRJfMs= @@ -43,6 +43,10 @@ github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4= github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mattn/kinako v0.0.0-20170717041458-332c0a7e205a h1:0Q3H0YXzMHiciXtRcM+j0jiCe8WKPQHoRgQiRTnfcLY= github.com/mattn/kinako v0.0.0-20170717041458-332c0a7e205a/go.mod h1:CdTTBOYzS5E4mWS1N8NWP6AHI19MP0A2B18n3hLzRMk= github.com/nats-io/nats.go v1.37.0 h1:07rauXbVnnJvv1gfIyghFEo6lUcYRY0WXc3x7x0vUxE= @@ -58,6 +62,8 @@ github.com/peteole/testdata-loader v0.3.0/go.mod h1:Mt0ZbRtb56u8SLJpNP+BnQbENljM github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= @@ -76,6 +82,8 @@ golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/leonelquinteros/gotext.v1 v1.3.1 h1:8d9/fdTG0kn/B7NNGV1BsEyvektXFAbkMsTZS2sFSCc= gopkg.in/leonelquinteros/gotext.v1 v1.3.1/go.mod h1:X1WlGDeAFIYsW6GjgMm4VwUwZ2XjI7Zan2InxSUQWrU= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/testutil/api.go b/internal/testutil/api.go deleted file mode 100644 index 5d8c8a9..0000000 --- a/internal/testutil/api.go +++ /dev/null @@ -1,59 +0,0 @@ -package testutil - -import ( - "context" - - "git.defalsify.org/vise.git/logging" - dataserviceapi "github.com/grassrootseconomics/ussd-data-service/pkg/api" - "git.grassecon.net/grassrootseconomics/sarafu-api/models" -) - -var ( - logg = logging.NewVanilla().WithDomain("sarafu-vise-events.testutil") -) - -const ( - AliceChecksum = "0xeae046BF396e91f5A8D74f863dC57c107c8a4a70" - BobChecksum = "0xB3117202371853e24B725d4169D87616A7dDb127" - AliceSession = "5553425" -) - -type MockApi struct { - TransactionsContent []dataserviceapi.Last10TxResponse - VouchersContent []dataserviceapi.TokenHoldings - VoucherDataContent *models.VoucherDataResult -} - -func(m MockApi) CheckBalance(ctx context.Context, publicKey string) (*models.BalanceResult, error) { - return nil, nil -} - -func(m MockApi) CreateAccount(ctx context.Context) (*models.AccountResult, error) { - return nil, nil -} - -func(m MockApi) TrackAccountStatus(ctx context.Context, publicKey string) (*models.TrackStatusResult, error) { - return nil, nil -} - -func(m MockApi) FetchVouchers(ctx context.Context, publicKey string) ([]dataserviceapi.TokenHoldings, error) { - logg.DebugCtxf(ctx, "mockapi fetchvouchers", "key", publicKey) - return m.VouchersContent, nil -} - -func(m MockApi) FetchTransactions(ctx context.Context, publicKey string) ([]dataserviceapi.Last10TxResponse, error) { - logg.DebugCtxf(ctx, "mockapi fetchtransactions", "key", publicKey) - return m.TransactionsContent, nil -} - -func(m MockApi) VoucherData(ctx context.Context, address string) (*models.VoucherDataResult, error) { - return m.VoucherDataContent, nil -} - -func(m MockApi) CheckAliasAddress(ctx context.Context, alias string) (*dataserviceapi.AliasAddress, error) { - return nil, nil -} - -func(m MockApi) TokenTransfer(ctx context.Context, amount, from, to, tokenAddress string) (*models.TokenTransferResponse, error) { - return nil, nil -}