From 82250db42d7c5dcb7e5a26d35e997c79c39dce5c Mon Sep 17 00:00:00 2001 From: inertia <amartin75@gmail.com> Date: Sun, 14 Jun 2020 19:40:57 -0700 Subject: [PATCH] api_name propagation --- lib/hive/block_api.rb | 4 ++-- lib/hive/jsonrpc.rb | 2 +- test/hive/account_history_api_test.rb | 2 +- test/hive/jsonrpc_test.rb | 2 ++ test/hive/stream_test.rb | 7 ++++++- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/hive/block_api.rb b/lib/hive/block_api.rb index b77e2b6..1d442e7 100644 --- a/lib/hive/block_api.rb +++ b/lib/hive/block_api.rb @@ -52,7 +52,7 @@ module Hive if !!block index = 0 - @rpc_client.rpc_batch_execute(request_object: request_object) do |result, error, id| + @rpc_client.rpc_batch_execute(api_name: self.class.api_name, request_object: request_object) do |result, error, id| block_num = sub_range.to_a[index] index = index + 1 @@ -66,7 +66,7 @@ module Hive else blocks = [] - @rpc_client.rpc_batch_execute(request_object: request_object) do |result, error, id| + @rpc_client.rpc_batch_execute(api_name: self.class.api_name, request_object: request_object) do |result, error, id| blocks << result end end diff --git a/lib/hive/jsonrpc.rb b/lib/hive/jsonrpc.rb index f35c014..9b56c03 100644 --- a/lib/hive/jsonrpc.rb +++ b/lib/hive/jsonrpc.rb @@ -90,7 +90,7 @@ module Hive end for request_object in chunks do - @rpc_client.rpc_batch_execute(request_object: request_object) do |result, error, id| + @rpc_client.rpc_batch_execute(api_name: self.class.api_name, request_object: request_object) do |result, error, id| api, method = method_map[id] api = api.to_sym method = method.to_sym diff --git a/test/hive/account_history_api_test.rb b/test/hive/account_history_api_test.rb index 1801a3e..65c29e9 100644 --- a/test/hive/account_history_api_test.rb +++ b/test/hive/account_history_api_test.rb @@ -63,7 +63,7 @@ module Hive } @api.get_transaction(options) do |result| - assert_equal Hashie::Array, result.history.class + assert_equal Hashie::Mash, result.class end end end diff --git a/test/hive/jsonrpc_test.rb b/test/hive/jsonrpc_test.rb index e934125..d9e217b 100644 --- a/test/hive/jsonrpc_test.rb +++ b/test/hive/jsonrpc_test.rb @@ -299,7 +299,9 @@ module Hive assert_raises SocketError, Errno::ECONNREFUSED do jsonrpc = Jsonrpc.new(url: 'https://bad.node') jsonrpc.get_methods + # :nocov: fail 'regression detected, SocketError or Errno::ECONNREFUSED expected' + # :nocov: end end end diff --git a/test/hive/stream_test.rb b/test/hive/stream_test.rb index 57959f8..ded5379 100644 --- a/test/hive/stream_test.rb +++ b/test/hive/stream_test.rb @@ -138,6 +138,7 @@ module Hive end def test_operations_by_deprecated_type + votes_found = false options = { until_block_num: @last_irreversible_block_num + 1, types: :vote @@ -148,7 +149,11 @@ module Hive assert op assert trx_id assert block_num + + votes_found = true end + + fail 'no vote ops found' unless votes_found end end @@ -187,4 +192,4 @@ module Hive end end end -end \ No newline at end of file +end -- GitLab