Skip to content

Commit

Permalink
fix expect / include assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Stachyra committed Apr 9, 2021
1 parent b0701a9 commit c832eb5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
14 changes: 7 additions & 7 deletions test/e2e/spec/byron_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,23 @@
addr = BYRON.addresses.list(id)[0]['id']
addr_import = BYRON.addresses.import(id, addr)
expect(addr_import).to have_http 403
expect(addr_import).to include "invalid_wallet_type"
expect(addr_import.to_s).to include "invalid_wallet_type"
end

it "I cannot import address - ledger" do
id = create_byron_wallet "ledger"
addr = BYRON.addresses.list(id)[0]['id']
addr_import = BYRON.addresses.import(id, addr)
expect(addr_import).to have_http 403
expect(addr_import).to include "invalid_wallet_type"
expect(addr_import.to_s).to include "invalid_wallet_type"
end

it "I cannot import address - trezor" do
id = create_byron_wallet "trezor"
addr = BYRON.addresses.list(id)[0]['id']
addr_import = BYRON.addresses.import(id, addr)
expect(addr_import).to have_http 403
expect(addr_import).to include "invalid_wallet_type"
expect(addr_import.to_s).to include "invalid_wallet_type"
end
end

Expand All @@ -188,7 +188,7 @@
rnd = BYRON.coin_selections.random wid, addr_amount

expect(rnd).to have_http 403
expect(rnd).to include "not_enough_money"
expect(rnd.to_s).to include "not_enough_money"
end

it "ArgumentError on bad argument address_amount" do
Expand Down Expand Up @@ -218,7 +218,7 @@
wid = create_byron_wallet style
txs = BYRON.transactions
expect(txs.get(wid, TXID)).to have_http 404
expect(txs.get(wid, TXID)).to include "no_such_transaction"
expect(txs.get(wid, TXID).to_s).to include "no_such_transaction"
end

it "Can list transactions - #{style}" do
Expand All @@ -241,7 +241,7 @@

tx_sent = BYRON.transactions.create(id, PASS, [{target_addr => 1000000}])
expect(tx_sent).to have_http 403
expect(tx_sent).to include "not_enough_money"
expect(tx_sent.to_s).to include "not_enough_money"
end

it "I could estimate fees if I had money - #{style}" do
Expand All @@ -251,7 +251,7 @@

fees = BYRON.transactions.payment_fees(id, [{target_addr => 1000000}])
expect(fees).to have_http 403
expect(fees).to include "not_enough_money"
expect(fees.to_s).to include "not_enough_money"
end

it "I could forget transaction - #{style}" do
Expand Down
18 changes: 9 additions & 9 deletions test/e2e/spec/e2e_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@

join = pools.join(SPID, @wid, PASS)
expect(join).to have_http 404
expect(join).to include "no_such_pool"
expect(join.to_s).to include "no_such_pool"
end

it "I could check delegation fees - if I could cover fee" do
Expand All @@ -273,7 +273,7 @@
pools = SHELLEY.stake_pools
fees = pools.delegation_fees(id)
expect(fees).to have_http 403
expect(fees).to include "not_enough_money"
expect(fees.to_s).to include "not_enough_money"
end

it "I could join Stake Pool - if I had enough to cover fee" do
Expand All @@ -283,15 +283,15 @@

join = pools.join(pool_id, id, PASS)
expect(join).to have_http 403
expect(join).to include "not_enough_money"
expect(join.to_s).to include "not_enough_money"
end

it "Can list stake pools only when stake is provided" do
pools = SHELLEY.stake_pools
expect(pools.list({stake: 1000})).to have_http 200

expect(pools.list).to have_http 400
expect(pools.list).to include "query_param_missing"
expect(pools.list.to_s).to include "query_param_missing"
end

it "Can join and quit Stake Pool" do
Expand Down Expand Up @@ -321,7 +321,7 @@
join = pools.join(pool_id, @target_id_pools, PASS)

expect(join).to have_http 202
expect(join).to include "status"
expect(join.to_s).to include "status"

join_tx_id = join['id']
eventually "Checking if join tx id (#{join_tx_id}) is in_ledger" do
Expand All @@ -334,7 +334,7 @@
quit = pools.quit(@target_id_pools, PASS)

expect(quit).to have_http 202
expect(quit).to include "status"
expect(quit.to_s).to include "status"

quit_tx_id = quit['id']
eventually "Checking if quit tx id (#{quit_tx_id}) is in_ledger" do
Expand Down Expand Up @@ -397,7 +397,7 @@

rnd = SHELLEY.coin_selections.random_deleg wid, action_join
expect(rnd).to have_http 403
expect(rnd).to include "not_enough_money"
expect(rnd.to_s).to include "not_enough_money"
end

it "I could trigger random coin selection delegation action - if I known pool id" do
Expand All @@ -408,11 +408,11 @@

rnd = SHELLEY.coin_selections.random_deleg wid, action_join
expect(rnd).to have_http 404
expect(rnd).to include "no_such_pool"
expect(rnd.to_s).to include "no_such_pool"

rnd = SHELLEY.coin_selections.random_deleg wid, action_quit
expect(rnd).to have_http 403
expect(rnd).to include "not_delegating_to"
expect(rnd.to_s).to include "not_delegating_to"
end

end
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/spec/misc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
addr = "addr"
res = UTILS.addresses addr
expect(res).to have_http 400
expect(res).to include "bad_request"
expect(res.to_s).to include "bad_request"
end

it "Inspect Shelley payment address" do
Expand Down
24 changes: 12 additions & 12 deletions test/e2e/spec/shelley_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@

rnd = SHELLEY.coin_selections.random wid, addr_amount
expect(rnd).to have_http 403
expect(rnd).to include "not_enough_money"
expect(rnd.to_s).to include "not_enough_money"
end
end

Expand All @@ -164,7 +164,7 @@
wid = create_shelley_wallet
txs = SHELLEY.transactions
expect(txs.get(wid, TXID)).to have_http 404
expect(txs.get(wid, TXID)).to include "no_such_transaction"
expect(txs.get(wid, TXID).to_s).to include "no_such_transaction"
end

it "Can list transactions" do
Expand All @@ -190,7 +190,7 @@

tx_sent = txs.create(id, PASS, amt)
expect(tx_sent).to have_http 403
expect(tx_sent).to include "not_enough_money"
expect(tx_sent.to_s).to include "not_enough_money"
end

it "I could create transaction using rewards - if I had money" do
Expand All @@ -202,7 +202,7 @@

tx_sent = txs.create(id, PASS, amt, 'self')
expect(tx_sent).to have_http 403
expect(tx_sent).to include "not_enough_money"
expect(tx_sent.to_s).to include "not_enough_money"
end

it "I could estimate transaction fee - if I had money" do
Expand All @@ -215,11 +215,11 @@

fees = txs.payment_fees(id, amt)
expect(fees).to have_http 403
expect(fees).to include "not_enough_money"
expect(fees.to_s).to include "not_enough_money"

fees = txs.payment_fees(id, amt, 'self')
expect(fees).to have_http 403
expect(fees).to include "not_enough_money"
expect(fees.to_s).to include "not_enough_money"

metadata = { "0"=>{ "string"=>"cardano" },
"1"=>{ "int"=>14 },
Expand All @@ -230,7 +230,7 @@

fees = txs.payment_fees(id, amt, 'self', metadata)
expect(fees).to have_http 403
expect(fees).to include "not_enough_money"
expect(fees.to_s).to include "not_enough_money"
end

it "I could forget transaction" do
Expand Down Expand Up @@ -314,7 +314,7 @@
pools = SHELLEY.stake_pools
quit = pools.quit(id, PASS)
expect(quit).to have_http 403
expect(quit).to include "not_delegating_to"
expect(quit.to_s).to include "not_delegating_to"
end

end
Expand All @@ -328,7 +328,7 @@
id = create_shelley_wallet
cost = SHELLEY.migrations.cost(id)
expect(cost).to have_http 501
expect(cost).to include "not_implemented"
expect(cost.to_s).to include "not_implemented"
end

it "I could migrate all my funds" do
Expand All @@ -337,7 +337,7 @@
addrs = SHELLEY.addresses.list(target_id).map{ |a| a['id'] }
migr = SHELLEY.migrations.migrate(id, PASS, addrs)
expect(migr).to have_http 501
expect(migr).to include "not_implemented"
expect(migr.to_s).to include "not_implemented"
end
end

Expand Down Expand Up @@ -375,7 +375,7 @@
["0H", "1H", "2147483647H", "44H"].each do |index|
res = SHELLEY.keys.create_acc_public_key(wid, index, PASS, extended = true)
expect(res).to have_http 202
expect(res).to include "acc"
expect(res.to_s).to include "acc"
end
end

Expand All @@ -384,7 +384,7 @@
["0H", "1H", "2147483647H", "44H"].each do |index|
res = SHELLEY.keys.create_acc_public_key(wid, index, PASS, extended = false)
expect(res).to have_http 202
expect(res).to include "acc"
expect(res.to_s).to include "acc"
end
end

Expand Down

0 comments on commit c832eb5

Please sign in to comment.