blockbook/bchain/coins/litecoin/litecoinrpc_test.go
2018-08-29 21:29:09 +02:00

73 lines
1.4 KiB
Go

// +build integration
package litecoin
import (
"blockbook/bchain"
"blockbook/bchain/tests/rpc"
"encoding/json"
"flag"
"os"
"testing"
)
func getRPCClient(cfg json.RawMessage) (bchain.BlockChain, error) {
c, err := NewLitecoinRPC(cfg, nil)
if err != nil {
return nil, err
}
cli := c.(*LitecoinRPC)
cli.Parser = NewLitecoinParser(GetChainParams("main"), cli.ChainConfig)
if err != nil {
return nil, err
}
cli.Mempool = bchain.NewUTXOMempool(cli, cli.ChainConfig.MempoolWorkers, cli.ChainConfig.MempoolSubWorkers)
return cli, nil
}
var rpcTest *rpc.Test
func TestMain(m *testing.M) {
flag.Parse()
t, err := rpc.NewTest("Litecoin", getRPCClient)
if err != nil {
panic(err)
}
rpcTest = t
os.Exit(m.Run())
}
func TestLitecoinRPC_GetBlockHash(t *testing.T) {
rpcTest.TestGetBlockHash(t)
}
func TestLitecoinRPC_GetBlock(t *testing.T) {
rpcTest.TestGetBlock(t)
}
func TestLitecoinRPC_GetTransaction(t *testing.T) {
rpcTest.TestGetTransaction(t)
}
func TestLitecoinRPC_GetTransactionForMempool(t *testing.T) {
rpcTest.TestGetTransactionForMempool(t)
}
func TestLitecoinRPC_MempoolSync(t *testing.T) {
rpcTest.TestMempoolSync(t)
}
func TestLitecoinRPC_GetMempoolEntry(t *testing.T) {
rpcTest.TestGetMempoolEntry(t)
}
func TestLitecoinRPC_EstimateSmartFee(t *testing.T) {
rpcTest.TestEstimateSmartFee(t)
}
func TestLitecoinRPC_EstimateFee(t *testing.T) {
rpcTest.TestEstimateFee(t)
}