Fix tests

This commit is contained in:
Patrick O'Grady 2020-09-28 08:09:07 -07:00
parent f37487e905
commit 283cdf433d
No known key found for this signature in database
GPG key ID: 8DE11C985C0C8D85

View file

@ -27,7 +27,7 @@ import (
)
var (
middlewareVersion = "0.0.2"
middlewareVersion = "0.0.3"
defaultNetworkOptions = &types.NetworkOptionsResponse{
Version: &types.Version{
RosettaVersion: "1.4.4",
@ -80,6 +80,7 @@ func TestNetworkEndpoints_Online(t *testing.T) {
cfg := &configuration.Configuration{
Mode: configuration.Online,
Network: networkIdentifier,
GenesisBlockIdentifier: bitcoin.MainnetGenesisBlockIdentifier,
}
mockIndexer := &mocks.Indexer{}
mockClient := &mocks.Client{}
@ -92,9 +93,6 @@ func TestNetworkEndpoints_Online(t *testing.T) {
networkIdentifier,
}, networkList.NetworkIdentifiers)
rawStatus := &types.NetworkStatusResponse{
GenesisBlockIdentifier: bitcoin.MainnetGenesisBlockIdentifier,
}
blockResponse := &types.BlockResponse{
Block: &types.Block{
BlockIdentifier: &types.BlockIdentifier{
@ -103,7 +101,11 @@ func TestNetworkEndpoints_Online(t *testing.T) {
},
},
}
mockClient.On("NetworkStatus", ctx).Return(rawStatus, nil)
mockClient.On("GetPeers", ctx).Return([]*types.Peer{
{
PeerID: "77.93.223.9:8333",
},
}, nil)
mockIndexer.On(
"GetBlockLazy",
ctx,
@ -117,6 +119,11 @@ func TestNetworkEndpoints_Online(t *testing.T) {
assert.Equal(t, &types.NetworkStatusResponse{
GenesisBlockIdentifier: bitcoin.MainnetGenesisBlockIdentifier,
CurrentBlockIdentifier: blockResponse.Block.BlockIdentifier,
Peers: []*types.Peer{
{
PeerID: "77.93.223.9:8333",
},
},
}, networkStatus)
networkOptions, err := servicer.NetworkOptions(ctx, nil)