storj/satellite/payments/coinpayments/transactions_test.go
Bill Thorp 66661c7486 satellite/coinpayments: query status of >25 coinpayments
Allow more than 25 coin payment statuses to be queries from coinpayments.net
Add some slight logging, a coinpayments duration metric, and a disabled test

These changes are small changes in support of https://storjlabs.atlassian.net/browse/USR-801

Change-Id: I5b176cdd5e513d8bd88b92f9b22a8bd2456bbdd5
2020-07-01 09:04:16 +00:00

49 lines
1.1 KiB
Go

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
package coinpayments
import (
"math/big"
"testing"
"github.com/stretchr/testify/assert"
"storj.io/common/testcontext"
)
func TestListInfos(t *testing.T) {
//This test is deliberately skipped as it requires credentials to coinpayments.net
t.SkipNow()
ctx := testcontext.New(t)
defer ctx.Cleanup()
payments := NewClient(Credentials{
PublicKey: "ask-littleskunk-on-keybase",
PrivateKey: "ask-littleskunk-on-keybase",
}).Transactions()
//verify that bad ids fail
infos, err := payments.ListInfos(ctx, TransactionIDList{"an_unlikely_id"})
assert.Error(t, err)
assert.Len(t, infos, 0)
//verify that ListInfos can handle more than 25 good ids
ids := TransactionIDList{}
for x := 0; x < 27; x++ {
tx, err := payments.Create(ctx,
&CreateTX{
Amount: *big.NewFloat(100),
CurrencyIn: CurrencySTORJ,
CurrencyOut: CurrencySTORJ,
BuyerEmail: "test@test.com",
},
)
ids = append(ids, tx.ID)
assert.NoError(t, err)
}
infos, err = payments.ListInfos(ctx, ids)
assert.NoError(t, err)
assert.Len(t, infos, 27)
}