Skip to content
Snippets Groups Projects
Commit 3976260b authored by inertia's avatar inertia
Browse files

tests

parent 52a1cd5d
No related branches found
No related tags found
1 merge request!5HF27
......@@ -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,
......
......@@ -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
......
......@@ -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.
......
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment