Merge pull request #207 from harmony-one/rj_branch

Add basic tests for wallet
pull/210/head
Rongjian Lan 6 years ago committed by GitHub
commit 0da063ba86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 37
      cmd/client/wallet/wallet_test.go

@ -0,0 +1,37 @@
package main
import (
"github.com/golang/mock/gomock"
"github.com/harmony-one/harmony/api/client"
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/node"
"github.com/harmony-one/harmony/p2p"
mock_host "github.com/harmony-one/harmony/p2p/host/mock"
"testing"
"time"
)
func TestCreateWalletNode(test *testing.T) {
walletNode := CreateWalletNode()
if walletNode.Client == nil {
test.Errorf("Wallet node's client is not initialized")
}
}
func TestSubmitTransaction(test *testing.T) {
ctrl := gomock.NewController(test)
defer ctrl.Finish()
m := mock_host.NewMockHost(ctrl)
m.EXPECT().GetSelfPeer().AnyTimes()
m.EXPECT().SendMessage(gomock.Any(), gomock.Any()).Times(1)
walletNode := node.New(m, nil, nil)
walletNode.Client = client.NewClient(walletNode.GetHost(), &map[uint32]p2p.Peer{0: p2p.Peer{IP: "1", Port: "2"}})
SubmitTransaction(&types.Transaction{}, walletNode, 0)
time.Sleep(1 * time.Second)
}
Loading…
Cancel
Save