From 3976260b4de862aeba9bc52fb8f53816faaa5018 Mon Sep 17 00:00:00 2001
From: Anthony Martin <amartin75@gmail.com>
Date: Fri, 28 Oct 2022 15:44:12 -0700
Subject: [PATCH] tests

---
 test/hive/api_test.rb                   | 12 ++----
 test/hive/database_api_test.rb          |  2 +-
 test/hive/jsonrpc_test.rb               | 49 +++++++++++++++++++++++--
 test/hive/network_broadcast_api_test.rb | 24 +-----------
 test/hive/rc_api_test.rb                |  2 +-
 5 files changed, 53 insertions(+), 36 deletions(-)

diff --git a/test/hive/api_test.rb b/test/hive/api_test.rb
index 82c27a2..169413c 100644
--- a/test/hive/api_test.rb
+++ b/test/hive/api_test.rb
@@ -80,13 +80,13 @@ module Hive
     end
     
     def test_inspect
-      assert_equal "#<CondenserApi [@chain=hive, @methods=<90 elements>]>", @api.inspect
+      assert_equal "#<CondenserApi [@chain=hive, @methods=<92 elements>]>", @api.inspect
     end
     
     def test_inspect_testnet
       vcr_cassette("#{@api.class.api_name}_testnet") do
         api = Api.new(chain: :test) rescue skip('testnet currently unavilable')
-        assert_equal "#<CondenserApi [@chain=test, @methods=<87 elements>]>", api.inspect
+        assert_equal "#<CondenserApi [@chain=test, @methods=<86 elements>]>", api.inspect
       end
     end
     
@@ -114,12 +114,8 @@ module Hive
       vcr_cassette("#{@api.class.api_name}_all_methods") do
         @methods.each do |key|
           case key
-          when :broadcast_block then
-            assert_raises BlockTooOldError, "expect void arguments to raise BlockTooOldError for: #{key}" do
-              assert @api.send key, {}
-            end
           when :broadcast_transaction then
-            assert_raises EmptyTransactionError, "expect void arguments to raise EmptyTransactionError for: #{key}" do
+            assert_raises TransactionExpiredError, "expect void arguments to raise TransactionExpiredError for: #{key}" do
               assert @api.send key, {
                 ref_block_num: 0,
                 ref_block_prefix: 0,
@@ -130,7 +126,7 @@ module Hive
               }
             end
           when :broadcast_transaction_synchronous then
-            assert_raises EmptyTransactionError, "expect void arguments to raise EmptyTransactionError for: #{key}" do
+            assert_raises TransactionExpiredError, "expect void arguments to raise TransactionExpiredError for: #{key}" do
               assert @api.send key, {
                 ref_block_num: 0,
                 ref_block_prefix: 0,
diff --git a/test/hive/database_api_test.rb b/test/hive/database_api_test.rb
index dc3f5e9..c5a7598 100644
--- a/test/hive/database_api_test.rb
+++ b/test/hive/database_api_test.rb
@@ -627,7 +627,7 @@ module Hive
           assert_raises NoMethodError do
             @api.get_version
           end
-        when '0.20.0', '0.23.0', '1.24.0', '1.25.0'
+        when '0.20.0', '0.23.0', '1.24.0', '1.25.0', '1.27.0'
           @api.get_version do |version|
             assert version.chain_id
           end
diff --git a/test/hive/jsonrpc_test.rb b/test/hive/jsonrpc_test.rb
index 3c4947e..8d0507c 100644
--- a/test/hive/jsonrpc_test.rb
+++ b/test/hive/jsonrpc_test.rb
@@ -33,7 +33,6 @@ module Hive
             "get_block_header"
           ],
           condenser_api: [
-            "broadcast_block",
             "broadcast_transaction",
             "broadcast_transaction_synchronous",
             "get_account_count",
@@ -122,7 +121,10 @@ module Hive
             "list_proposals",
             "find_recurrent_transfers",
             "get_collateralized_conversion_requests",
-            "is_known_transaction"
+            "is_known_transaction",
+            "find_rc_accounts",
+            "list_rc_accounts",
+            "list_rc_direct_delegations"
           ],
           database_api: [
             "find_account_recovery_requests",
@@ -207,13 +209,14 @@ module Hive
             "get_volume"
           ],
           network_broadcast_api: [
-            "broadcast_block",
             "broadcast_transaction"
           ],
           rc_api: [
             "find_rc_accounts",
             "get_resource_params",
-            "get_resource_pool"
+            "get_resource_pool",
+            "list_rc_accounts",
+            "list_rc_direct_delegations"
           ],
           # tags_api: [
           #   "get_active_votes",
@@ -242,6 +245,43 @@ module Hive
           ],
           reputation_api: [
             "get_account_reputations"
+          ],
+          wallet_bridge_api: [
+            "broadcast_transaction",
+            "broadcast_transaction_synchronous",
+            "find_proposals",
+            "find_rc_accounts",
+            "find_recurrent_transfers",
+            "get_account",
+            "get_account_history",
+            "get_accounts",
+            "get_active_witnesses",
+            "get_block",
+            "get_chain_properties",
+            "get_collateralized_conversion_requests",
+            "get_conversion_requests",
+            "get_current_median_history_price",
+            "get_dynamic_global_properties",
+            "get_feed_history",
+            "get_hardfork_version",
+            "get_open_orders",
+            "get_ops_in_block",
+            "get_order_book",
+            "get_owner_history",
+            "get_reward_fund",
+            "get_transaction",
+            "get_version",
+            "get_withdraw_routes",
+            "get_witness",
+            "get_witness_schedule",
+            "is_known_transaction",
+            "list_accounts",
+            "list_my_accounts",
+            "list_proposal_votes",
+            "list_proposals",
+            "list_rc_accounts",
+            "list_rc_direct_delegations",
+            "list_witnesses"
           ]
         }
         
@@ -293,6 +333,7 @@ module Hive
             assert_equal Symbol, method.class, "did not expect: #{method.inspect}"
             
             next if api == :bridge
+            next if api == :wallet_bridge_api
             
             # TODO Remove this skip once all nodes have this signature.  Seems like
             # there's a node running a different version of hived atn the moment.
diff --git a/test/hive/network_broadcast_api_test.rb b/test/hive/network_broadcast_api_test.rb
index 7a0b5b5..903f320 100644
--- a/test/hive/network_broadcast_api_test.rb
+++ b/test/hive/network_broadcast_api_test.rb
@@ -12,7 +12,7 @@ module Hive
     end
     
     def test_inspect
-      assert_equal "#<NetworkBroadcastApi [@chain=hive, @methods=<2 elements>]>", @api.inspect
+      assert_equal "#<NetworkBroadcastApi [@chain=hive, @methods=<1 element>]>", @api.inspect
     end
     
     def test_method_missing
@@ -27,26 +27,6 @@ module Hive
       end
     end
     
-    def test_broadcast_block
-      vcr_cassette('broadcast_block') do
-        options = {
-          block: {
-            previous: "0000000000000000000000000000000000000000",
-            timestamp: "1970-01-01T00:00:00",
-            witness: "",
-            transaction_merkle_root: "0000000000000000000000000000000000000000",
-            extensions: [],
-            witness_signature: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
-            transactions: []
-          }
-        }
-        
-        assert_raises BlockTooOldError do
-          @api.broadcast_block(options)
-        end
-      end
-    end
-    
     def test_broadcast_transaction
       vcr_cassette('broadcast_transaction') do
         options = {
@@ -61,7 +41,7 @@ module Hive
           max_block_age: -1
         }
         
-        assert_raises EmptyTransactionError do
+        assert_raises TransactionExpiredError do
           @api.broadcast_transaction(options)
         end
       end
diff --git a/test/hive/rc_api_test.rb b/test/hive/rc_api_test.rb
index 4baf42d..86cb30f 100644
--- a/test/hive/rc_api_test.rb
+++ b/test/hive/rc_api_test.rb
@@ -13,7 +13,7 @@ module Hive
     end
     
     def test_inspect
-      assert_equal "#<RcApi [@chain=hive, @methods=<3 elements>]>", @api.inspect
+      assert_equal "#<RcApi [@chain=hive, @methods=<5 elements>]>", @api.inspect
     end
     
     def test_method_missing
-- 
GitLab