Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additional checks for listing stake keys in e2e tests
Browse files Browse the repository at this point in the history
Piotr Stachyra committed Jun 7, 2021

Unverified

No user is associated with the committer email.
1 parent d232400 commit 4e1734b
Showing 4 changed files with 46 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/e2e/Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'cardano_wallet', '~> 0.3.9'
gem 'cardano_wallet', '~> 0.3.10'
# gem 'cardano_wallet', path: "~/wb/cardano_wallet"
gem 'bip_mnemonic', '0.0.4'
gem 'rake', '12.3.3'
4 changes: 2 additions & 2 deletions test/e2e/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ GEM
remote: https://rubygems.org/
specs:
bip_mnemonic (0.0.4)
cardano_wallet (0.3.9)
cardano_wallet (0.3.10)
httparty (~> 0.18.0)
diff-lcs (1.4.4)
httparty (0.18.1)
@@ -32,7 +32,7 @@ PLATFORMS

DEPENDENCIES
bip_mnemonic (= 0.0.4)
cardano_wallet (~> 0.3.9)
cardano_wallet (~> 0.3.10)
rake (= 12.3.3)
rspec (= 3.10.0)

30 changes: 30 additions & 0 deletions test/e2e/spec/e2e_spec.rb
Original file line number Diff line number Diff line change
@@ -388,6 +388,16 @@
(available == amt) && (total == amt)
end

# Check wallet stake keys before joing stake pool
stake_keys = SHELLEY.stake_pools.list_stake_keys(@target_id_pools)
expect(stake_keys).to be_correct_and_respond 200
expect(stake_keys['foreign'].size).to eq 0
expect(stake_keys['ours'].size).to eq 1
expect(stake_keys['ours'].first['stake']['quantity']).to eq amt
expect(stake_keys['none']['stake']['quantity']).to eq 0
expect(stake_keys['ours'].first['delegation']['active']['status']).to eq "not_delegating"
expect(stake_keys['ours'].first['delegation']['next']).to eq []

# Pick up pool id to join
pools = SHELLEY.stake_pools
pool_id = pools.list({ stake: 1000 }).sample['id']
@@ -405,6 +415,16 @@
tx['status'] == "in_ledger"
end

# Check wallet stake keys after joing stake pool
stake_keys = SHELLEY.stake_pools.list_stake_keys(@target_id_pools)
expect(stake_keys).to be_correct_and_respond 200
expect(stake_keys['foreign'].size).to eq 0
expect(stake_keys['ours'].size).to eq 1
expect(stake_keys['ours'].first['stake']['quantity']).to be > 0
expect(stake_keys['none']['stake']['quantity']).to eq 0
expect(stake_keys['ours'].first['delegation']['active']['status']).to eq "not_delegating"
expect(stake_keys['ours'].first['delegation']['next'].first['status']).to eq "delegating"

# Quit pool
puts "Quitting pool: #{pool_id}"
quit = pools.quit(@target_id_pools, PASS)
@@ -417,6 +437,16 @@
tx = SHELLEY.transactions.get(@target_id_pools, quit_tx_id)
tx['status'] == "in_ledger"
end

# Check wallet stake keys after quitting stake pool
stake_keys = SHELLEY.stake_pools.list_stake_keys(@target_id_pools)
expect(stake_keys).to be_correct_and_respond 200
expect(stake_keys['foreign'].size).to eq 0
expect(stake_keys['ours'].size).to eq 1
expect(stake_keys['ours'].first['stake']['quantity']).to be > 0
expect(stake_keys['none']['stake']['quantity']).to eq 0
expect(stake_keys['ours'].first['delegation']['active']['status']).to eq "not_delegating"
expect(stake_keys['ours'].first['delegation']['next'].first['status']).to eq "not_delegating"
end
end

13 changes: 13 additions & 0 deletions test/e2e/spec/shelley_spec.rb
Original file line number Diff line number Diff line change
@@ -263,6 +263,19 @@
teardown
end

it "I can list stake keys" do
id = create_shelley_wallet
stake_keys = SHELLEY.stake_pools.list_stake_keys(id)
expect(stake_keys).to be_correct_and_respond 200
expect(stake_keys['foreign'].size).to eq 0
expect(stake_keys['ours'].size).to eq 1
expect(stake_keys['ours'].first['stake']).to eq({ "quantity" => 0, "unit" => "lovelace" })
expect(stake_keys['none']['stake']).to eq({ "quantity" => 0, "unit" => "lovelace" })
expect(stake_keys['ours'].first['delegation']).to eq({ "next" => [],
"active" =>
{ "status" => "not_delegating" } })
end

it "ADP-634 - Pool metadata is updated when settings are updated" do
settings = CardanoWallet.new.misc.settings
pools = SHELLEY.stake_pools

0 comments on commit 4e1734b

Please sign in to comment.