From 283cdf433dc3bb14668bf03feb546d27fd1600a1 Mon Sep 17 00:00:00 2001 From: Patrick O'Grady Date: Mon, 28 Sep 2020 08:09:07 -0700 Subject: [PATCH] Fix tests --- services/network_service_test.go | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/services/network_service_test.go b/services/network_service_test.go index 8d8dbb2..d60d6ed 100644 --- a/services/network_service_test.go +++ b/services/network_service_test.go @@ -27,7 +27,7 @@ import ( ) var ( - middlewareVersion = "0.0.2" + middlewareVersion = "0.0.3" defaultNetworkOptions = &types.NetworkOptionsResponse{ Version: &types.Version{ RosettaVersion: "1.4.4", @@ -78,8 +78,9 @@ func TestNetworkEndpoints_Offline(t *testing.T) { func TestNetworkEndpoints_Online(t *testing.T) { cfg := &configuration.Configuration{ - Mode: configuration.Online, - Network: networkIdentifier, + 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)