radiator 0.4.7 → 0.4.8.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/Rakefile +50 -20
- data/lib/radiator.rb +3 -1
- data/lib/radiator/api.rb +83 -10
- data/lib/radiator/bridge.rb +34 -0
- data/lib/radiator/chain_config.rb +9 -2
- data/lib/radiator/database_api.rb +1 -1
- data/lib/radiator/follow_api.rb +1 -1
- data/lib/radiator/market_history_api.rb +1 -1
- data/lib/radiator/operation.rb +3 -2
- data/lib/radiator/operation_types.rb +43 -27
- data/lib/radiator/ssc/base_steem_smart_contract_rpc.rb +1 -1
- data/lib/radiator/stream.rb +15 -6
- data/lib/radiator/transaction.rb +28 -1
- data/lib/radiator/type/amount.rb +26 -51
- data/lib/radiator/type/price.rb +2 -2
- data/lib/radiator/version.rb +1 -1
- data/radiator.gemspec +13 -11
- data/test/fixtures/empty.json +1 -0
- data/test/fixtures/error.json +29 -0
- data/test/fixtures/follow_api_get_followers.json +1 -0
- data/test/fixtures/get_account.json +165 -0
- data/test/fixtures/get_account_count.json +1 -0
- data/test/fixtures/get_account_references.json +1 -0
- data/test/fixtures/get_block.json +193 -0
- data/test/fixtures/get_dynamic_global_properties.json +32 -0
- data/test/fixtures/get_feed_history.json +684 -0
- data/test/fixtures/get_hardfork_version.json +1 -0
- data/test/fixtures/get_key_references.json +14 -0
- data/test/fixtures/get_stats_for_time.json +57 -0
- data/test/fixtures/get_vesting_delegation.json +936 -0
- data/test/fixtures/golos_get_dynamic_global_properties.json +32 -0
- data/test/fixtures/market_history_api_get_market_history_buckets.json +1 -0
- data/test/fixtures/market_history_api_get_order_book.json +109 -0
- data/test/fixtures/market_history_api_get_recent_trades.json +55 -0
- data/test/fixtures/market_history_api_get_ticker.json +11 -0
- data/test/fixtures/market_history_api_get_volume.json +1 -0
- data/test/fixtures/null.json +1 -0
- data/test/fixtures/vcr_cassettes/account_by_key_api_all_methods.yml +525 -0
- data/test/fixtures/vcr_cassettes/account_by_key_api_jsonrpc.yml +52 -0
- data/test/fixtures/vcr_cassettes/all_methods.yml +18155 -0
- data/test/fixtures/vcr_cassettes/api_all_methods.yml +13254 -0
- data/test/fixtures/vcr_cassettes/base_per_debt.yml +4946 -0
- data/test/fixtures/vcr_cassettes/base_per_mvest.yml +3969 -0
- data/test/fixtures/vcr_cassettes/block_time.yml +3322 -0
- data/test/fixtures/vcr_cassettes/broadcast_transaction.yml +1186 -0
- data/test/fixtures/vcr_cassettes/condenser_all_all_methods.yml +13297 -0
- data/test/fixtures/vcr_cassettes/expiration_initialize.yml +3428 -0
- data/test/fixtures/vcr_cassettes/find_account.yml +3681 -0
- data/test/fixtures/vcr_cassettes/find_block.yml +3589 -0
- data/test/fixtures/vcr_cassettes/find_comment.yml +11464 -0
- data/test/fixtures/vcr_cassettes/follow_api_jsonrpc.yml +52 -0
- data/test/fixtures/vcr_cassettes/get_account_count.yml +575 -0
- data/test/fixtures/vcr_cassettes/get_account_references.yml +608 -0
- data/test/fixtures/vcr_cassettes/get_accounts.yml +674 -0
- data/test/fixtures/vcr_cassettes/get_accounts_no_argument.yml +608 -0
- data/test/fixtures/vcr_cassettes/get_dynamic_global_properties.yml +661 -0
- data/test/fixtures/vcr_cassettes/get_feed_history.yml +1106 -0
- data/test/fixtures/vcr_cassettes/get_hardfork_version.yml +577 -0
- data/test/fixtures/vcr_cassettes/get_key_references.yml +987 -0
- data/test/fixtures/vcr_cassettes/get_market_history.yml +1043 -0
- data/test/fixtures/vcr_cassettes/get_market_history_buckets.yml +1043 -0
- data/test/fixtures/vcr_cassettes/get_order_book.yml +1091 -0
- data/test/fixtures/vcr_cassettes/get_recent_trades.yml +1043 -0
- data/test/fixtures/vcr_cassettes/get_ticker.yml +1047 -0
- data/test/fixtures/vcr_cassettes/get_trade_history.yml +1049 -0
- data/test/fixtures/vcr_cassettes/get_vesting_delegations.yml +523 -0
- data/test/fixtures/vcr_cassettes/get_volume.yml +1051 -0
- data/test/fixtures/vcr_cassettes/get_witness_by_account.yml +575 -0
- data/test/fixtures/vcr_cassettes/look_up_witnesses.yml +523 -0
- data/test/fixtures/vcr_cassettes/market_history_api_all_methods.yml +4373 -0
- data/test/fixtures/vcr_cassettes/network_broadcast_api_all_methods.yml +1288 -0
- data/test/fixtures/vcr_cassettes/properties.yml +3627 -0
- data/test/fixtures/vcr_cassettes/recover_transaction.yml +1099 -0
- data/test/fixtures/vcr_cassettes/ssc_blockchain_block_info.yml +92 -0
- data/test/fixtures/vcr_cassettes/ssc_blockchain_block_info_invalid.yml +90 -0
- data/test/fixtures/vcr_cassettes/ssc_blockchain_latest_block_info.yml +91 -0
- data/test/fixtures/vcr_cassettes/ssc_blockchain_transaction_info.yml +92 -0
- data/test/fixtures/vcr_cassettes/ssc_contracts_contract.yml +366 -0
- data/test/fixtures/vcr_cassettes/ssc_contracts_find.yml +91 -0
- data/test/fixtures/vcr_cassettes/ssc_contracts_find_one.yml +89 -0
- data/test/fixtures/vcr_cassettes/stream_jsonrpc.yml +8253 -0
- data/test/fixtures/vcr_cassettes/transaction_expiration_initialize_nil.yml +3176 -0
- data/test/fixtures/vcr_cassettes/transaction_jsonrpc.yml +151 -0
- data/test/fixtures/vcr_cassettes/unknown_chain_id.yml +3343 -0
- data/test/fixtures/vcr_cassettes/valid_chains.yml +3124 -0
- data/test/radiator/account_by_key_api_test.rb +46 -0
- data/test/radiator/api_test.rb +135 -0
- data/test/radiator/chain_stats_api_test.rb +49 -0
- data/test/radiator/chain_test.rb +153 -0
- data/test/radiator/condenser_api_test.rb +48 -0
- data/test/radiator/follow_api_test.rb +48 -0
- data/test/radiator/market_history_api_test.rb +100 -0
- data/test/radiator/network_broadcast_api_test.rb +48 -0
- data/test/radiator/operation_test.rb +117 -0
- data/test/radiator/ssc/blockchain_test.rb +58 -0
- data/test/radiator/ssc/contracts_test.rb +65 -0
- data/test/radiator/stream_test.rb +48 -0
- data/test/radiator/tag_api_test.rb +40 -0
- data/test/radiator/transaction_test.rb +755 -0
- data/test/test_helper.rb +66 -0
- metadata +182 -73
- data/.codeclimate.yml +0 -19
- data/.gitignore +0 -52
- data/.travis.yml +0 -23
- data/gource.sh +0 -8
- data/images/Anthony Martin.png +0 -0
- data/images/Marvin Hofmann.jpg +0 -0
- data/images/Marvin Hofmann.png +0 -0
- data/lib/steem.rb +0 -17
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Radiator
|
4
|
+
class MarketHistoryApiTest < Radiator::Test
|
5
|
+
def setup
|
6
|
+
vcr_cassette('market_history_api_jsonrpc') do
|
7
|
+
@api = Radiator::MarketHistoryApi.new(chain_options)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_method_missing
|
12
|
+
assert_raises NoMethodError do
|
13
|
+
@api.bogus
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_all_respond_to
|
18
|
+
vcr_cassette('market_history_api_all_respond_to') do
|
19
|
+
@api.method_names.each do |key|
|
20
|
+
assert @api.respond_to?(key), "expect rpc respond to #{key}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_all_methods
|
26
|
+
vcr_cassette('market_history_api_all_methods') do
|
27
|
+
@api.method_names.each do |key|
|
28
|
+
begin
|
29
|
+
assert @api.send key
|
30
|
+
rescue Steem::ArgumentError => e
|
31
|
+
# next
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_get_market_history
|
38
|
+
vcr_cassette('get_market_history') do
|
39
|
+
@api.get_market_history(nil, nil, nil) do |history|
|
40
|
+
assert_equal Hashie::Mash, history.class, history.inspect
|
41
|
+
assert_equal history.buckets, []
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_get_market_history_buckets
|
47
|
+
vcr_cassette('get_market_history_buckets') do
|
48
|
+
@api.get_market_history_buckets do |buckets|
|
49
|
+
assert_equal Hashie::Mash, buckets.class, buckets.inspect
|
50
|
+
assert buckets
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_get_order_book
|
56
|
+
vcr_cassette('get_order_book') do
|
57
|
+
@api.get_order_book(limit: 10) do |order_book|
|
58
|
+
assert_equal Hashie::Mash, order_book.class, order_book.inspect
|
59
|
+
assert order_book
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_get_recent_trades
|
65
|
+
vcr_cassette('get_recent_trades') do
|
66
|
+
@api.get_recent_trades(limit: 10) do |trades|
|
67
|
+
assert_equal Hashie::Mash, trades.class, trades.inspect
|
68
|
+
assert trades.trades
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_get_ticker
|
74
|
+
vcr_cassette('get_ticker') do
|
75
|
+
@api.get_ticker do |ticker|
|
76
|
+
assert_equal Hashie::Mash, ticker.class, ticker.inspect
|
77
|
+
assert ticker
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_get_trade_history
|
83
|
+
vcr_cassette('get_trade_history') do
|
84
|
+
@api.get_trade_history(nil, nil, nil) do |history|
|
85
|
+
assert_equal Hashie::Mash, history.class, history.inspect
|
86
|
+
assert_equal history.trades, []
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_get_volume
|
92
|
+
vcr_cassette('get_volume') do
|
93
|
+
@api.get_volume do |volume|
|
94
|
+
assert_equal Hashie::Mash, volume.class, volume.inspect
|
95
|
+
assert volume
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Radiator
|
4
|
+
class NetworkBroadcastApiTest < Radiator::Test
|
5
|
+
def setup
|
6
|
+
vcr_cassette('network_broadcast_api_jsonrpc') do
|
7
|
+
@api = Radiator::NetworkBroadcastApi.new(chain_options)
|
8
|
+
@silent_api = Radiator::NetworkBroadcastApi.new(chain_options.merge(logger: LOGGER))
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_method_missing
|
13
|
+
assert_raises NoMethodError do
|
14
|
+
@api.bogus
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_all_respond_to
|
19
|
+
vcr_cassette('network_broadcast_api_all_respond_to') do
|
20
|
+
@api.method_names.each do |key|
|
21
|
+
assert @api.respond_to?(key), "expect rpc respond to #{key}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_all_methods
|
27
|
+
vcr_cassette('network_broadcast_api_all_methods') do
|
28
|
+
@silent_api.method_names.each do |key|
|
29
|
+
begin
|
30
|
+
assert @silent_api.send key
|
31
|
+
rescue Steem::ArgumentError => e
|
32
|
+
# next
|
33
|
+
rescue Steem::RemoteNodeError => e
|
34
|
+
# next
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_broadcast_transaction
|
41
|
+
vcr_cassette('broadcast_transaction') do
|
42
|
+
assert_raises Steem::RemoteNodeError do
|
43
|
+
@silent_api.broadcast_transaction
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Radiator
|
4
|
+
class OperationTest < Radiator::Test
|
5
|
+
def test_unsupported_operation_type
|
6
|
+
assert_raises OperationError, 'expect operation type not to be supported' do
|
7
|
+
Radiator::Operation.new
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_unsupported_param_type
|
12
|
+
operation = Radiator::Operation.new(type: :vote, voter: 0.0)
|
13
|
+
|
14
|
+
assert_raises OperationError, 'expect operation type not to be supported' do
|
15
|
+
operation.to_bytes
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_supported_string
|
20
|
+
operation = Radiator::Operation.new(type: :vote, voter: 'inertia')
|
21
|
+
|
22
|
+
assert_equal "\x00\ainertia", operation.to_bytes
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_supported_fixnum
|
26
|
+
operation = Radiator::Operation.new(type: :vote, weight: 10000)
|
27
|
+
|
28
|
+
assert_equal "\x00\x10'", operation.to_bytes
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_supported_true_class
|
32
|
+
operation = Radiator::Operation.new(type: :comment_options, allow_votes: true)
|
33
|
+
|
34
|
+
assert_equal "\x13\x01", operation.to_bytes
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_supported_false_class
|
38
|
+
operation = Radiator::Operation.new(type: :comment_options, allow_votes: false)
|
39
|
+
|
40
|
+
expected_bytes = "\x13\x00"
|
41
|
+
expected_bytes = expected_bytes.force_encoding('ASCII-8BIT')
|
42
|
+
|
43
|
+
assert_equal expected_bytes, operation.to_bytes
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_supported_empty_array_class
|
47
|
+
operation = Radiator::Operation.new(type: :comment_options, extensions: [])
|
48
|
+
|
49
|
+
expected_bytes = "\x13\x00"
|
50
|
+
expected_bytes = expected_bytes.force_encoding('ASCII-8BIT')
|
51
|
+
|
52
|
+
assert_equal expected_bytes, operation.to_bytes
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_supported_complex_array_class
|
56
|
+
extensions = [[0,{"beneficiaries":[{"account":"inertia","weight":500}]}]]
|
57
|
+
operation = Radiator::Operation.new(type: :comment_options, extensions: extensions)
|
58
|
+
|
59
|
+
expected_bytes = "\x13\x01\x02\x00\x00\x01\rbeneficiaries\x01\x02\aaccount\ainertia\x06weight\xF4\x01"
|
60
|
+
expected_bytes = expected_bytes.force_encoding('ASCII-8BIT')
|
61
|
+
|
62
|
+
assert_equal expected_bytes, operation.to_bytes
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_supported_nil_class
|
66
|
+
operation = Radiator::Operation.new(type: :comment, json_metadata: nil)
|
67
|
+
|
68
|
+
assert_equal "\x01", operation.to_bytes
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_supported_array
|
72
|
+
operation = Radiator::Operation.new(type: :custom_json, required_auths: [])
|
73
|
+
|
74
|
+
assert_equal "\x12\x00", operation.to_bytes
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_operation_payload
|
78
|
+
operation = Radiator::Operation.new(
|
79
|
+
chain: :hive,
|
80
|
+
type: :comment_options,
|
81
|
+
author: 'xeroc',
|
82
|
+
permlink: 'piston',
|
83
|
+
max_accepted_payout: '1000000.000 HBD',
|
84
|
+
percent_steem_dollars: 10000,
|
85
|
+
# allow_replies: true,
|
86
|
+
allow_votes: true,
|
87
|
+
allow_curation_rewards: true,
|
88
|
+
extensions: Radiator::Type::Beneficiaries.new('good-karma' => 2000, 'null' => 5000)
|
89
|
+
)
|
90
|
+
|
91
|
+
# Note, we still expect `SBD` in bytes from seralization.
|
92
|
+
expected_bytes = "\x13\x05xeroc\x06piston\x00\xCA\x9A;\x00\x00\x00\x00\x03SBD\x00\x00\x00\x00\x10'\x01\x01\x01\x00\x02\ngood-karma\xD0\a\x04null\x88\x13"
|
93
|
+
expected_bytes = expected_bytes.force_encoding('ASCII-8BIT')
|
94
|
+
|
95
|
+
assert_equal expected_bytes, operation.to_bytes
|
96
|
+
|
97
|
+
expected_payload = [:comment_options, {
|
98
|
+
author: 'xeroc',
|
99
|
+
permlink: 'piston',
|
100
|
+
max_accepted_payout: Hive::Type::Amount.new('1000000.000 HBD'),
|
101
|
+
percent_steem_dollars: 10000,
|
102
|
+
allow_votes: true,
|
103
|
+
allow_curation_rewards: true,
|
104
|
+
extensions: [[0, {beneficiaries: [{
|
105
|
+
account: 'good-karma',
|
106
|
+
weight: 2000
|
107
|
+
}, {
|
108
|
+
account: 'null',
|
109
|
+
weight: 5000
|
110
|
+
}]}]]
|
111
|
+
}]
|
112
|
+
|
113
|
+
assert_equal expected_payload[0], operation.payload[0]
|
114
|
+
assert_equal expected_payload[1].keys, operation.payload[1].keys
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Radiator
|
4
|
+
module SSC
|
5
|
+
class BlockchainTest < Radiator::Test
|
6
|
+
def setup
|
7
|
+
@rpc = Radiator::SSC::Blockchain.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
@rpc.shutdown
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_latest_block_info
|
15
|
+
vcr_cassette('ssc_blockchain_latest_block_info') do
|
16
|
+
assert @rpc.latest_block_info
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_block_info
|
21
|
+
vcr_cassette('ssc_blockchain_block_info') do
|
22
|
+
block_num = 1
|
23
|
+
block_info = @rpc.block_info(block_num)
|
24
|
+
assert block_info
|
25
|
+
assert_equal block_num, block_info.blockNumber
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_block_info_invalid
|
30
|
+
vcr_cassette('ssc_blockchain_block_info_invalid') do
|
31
|
+
assert_raises Radiator::ApiError do
|
32
|
+
@rpc.block_info('WRONG')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_transaction_info
|
38
|
+
vcr_cassette('ssc_blockchain_transaction_info') do
|
39
|
+
trx_id = 'df846ffdbd87f3fae2a60993dae9d16d44c814e3'
|
40
|
+
transaction_info = @rpc.transaction_info(trx_id)
|
41
|
+
assert transaction_info
|
42
|
+
assert_equal trx_id, transaction_info.transactionId
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_no_persist_transaction_info
|
47
|
+
rpc = Radiator::SSC::Blockchain.new(persist: false)
|
48
|
+
|
49
|
+
vcr_cassette('ssc_blockchain_transaction_info') do
|
50
|
+
trx_id = 'df846ffdbd87f3fae2a60993dae9d16d44c814e3'
|
51
|
+
transaction_info = rpc.transaction_info(trx_id)
|
52
|
+
assert transaction_info
|
53
|
+
assert_equal trx_id, transaction_info.transactionId
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Radiator
|
4
|
+
module SSC
|
5
|
+
class ContractsTest < Radiator::Test
|
6
|
+
def setup
|
7
|
+
@rpc = Radiator::SSC::Contracts.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_contract
|
11
|
+
vcr_cassette('ssc_contracts_contract') do
|
12
|
+
assert @rpc.contract('tokens')
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_find_one
|
17
|
+
vcr_cassette('ssc_contracts_find_one') do
|
18
|
+
params = {
|
19
|
+
contract: 'tokens',
|
20
|
+
table: 'balances',
|
21
|
+
query: {
|
22
|
+
symbol: 'STINGY',
|
23
|
+
account: 'inertia'
|
24
|
+
}
|
25
|
+
}
|
26
|
+
result = @rpc.find_one(params)
|
27
|
+
assert result
|
28
|
+
assert_equal 36.92931281, result.balance.to_f
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_find
|
33
|
+
vcr_cassette('ssc_contracts_find') do
|
34
|
+
params = {
|
35
|
+
contract: 'tokens',
|
36
|
+
table: 'balances',
|
37
|
+
query: {
|
38
|
+
symbol: 'STINGY'
|
39
|
+
}
|
40
|
+
}
|
41
|
+
result = @rpc.find(params)
|
42
|
+
assert result
|
43
|
+
assert_equal 33, result.size
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_no_persist_find
|
48
|
+
rpc = Radiator::SSC::Contracts.new(persist: false)
|
49
|
+
|
50
|
+
vcr_cassette('ssc_contracts_find') do
|
51
|
+
params = {
|
52
|
+
contract: 'tokens',
|
53
|
+
table: 'balances',
|
54
|
+
query: {
|
55
|
+
symbol: 'STINGY'
|
56
|
+
}
|
57
|
+
}
|
58
|
+
result = rpc.find(params)
|
59
|
+
assert result
|
60
|
+
assert_equal 33, result.size
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Radiator
|
4
|
+
class StreamTest < Radiator::Test
|
5
|
+
def setup
|
6
|
+
vcr_cassette('stream_jsonrpc') do
|
7
|
+
@api = Radiator::Stream.new
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_method_missing
|
12
|
+
assert_raises NoMethodError do
|
13
|
+
@api.bogus
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_all_respond_to
|
18
|
+
vcr_cassette('stream_all_respond_to') do
|
19
|
+
@api.method_names.each do |key|
|
20
|
+
assert @api.respond_to?(key), "expect rpc respond to #{key}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_all_methods
|
26
|
+
vcr_cassette('stream_all_methods') do
|
27
|
+
skip "cannot execute an asynchronous request in tests"
|
28
|
+
|
29
|
+
@api.method_names.each do |key|
|
30
|
+
begin
|
31
|
+
assert @api.send key
|
32
|
+
rescue Steem::ArgumentError => e
|
33
|
+
# next
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_get_operations
|
40
|
+
skip "cannot execute an asynchronous request in tests"
|
41
|
+
|
42
|
+
vcr_cassette('get_operations') do
|
43
|
+
@api.operations
|
44
|
+
assert_equal Hashie::Mash, response.class, response.inspect
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Radiator
|
4
|
+
class TagApiTest < Radiator::Test
|
5
|
+
def setup
|
6
|
+
vcr_cassette('tag_api_jsonrpc') do
|
7
|
+
@api = Radiator::TagApi.new(chain_options)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_method_missing
|
12
|
+
assert_raises NoMethodError do
|
13
|
+
@api.bogus
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_all_respond_to
|
18
|
+
vcr_cassette('tag_api_all_respond_to') do
|
19
|
+
@api.method_names.each do |key|
|
20
|
+
assert @api.respond_to?(key), "expect rpc respond to #{key}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_all_methods
|
26
|
+
vcr_cassette('tag_api_all_methods') do
|
27
|
+
skip
|
28
|
+
vcr_cassette('all_methods') do
|
29
|
+
@api.method_names.each do |key|
|
30
|
+
begin
|
31
|
+
assert @api.send key
|
32
|
+
rescue Steem::ArgumentError => e
|
33
|
+
# next
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|