test/commands/test_pull.rb in zold-0.20.4 vs test/commands/test_pull.rb in zold-0.21.0
- old
+ new
@@ -36,13 +36,14 @@
def test_pull_wallet
FakeHome.new(log: test_log).run do |home|
remotes = home.remotes
remotes.add('localhost', 4096)
json = home.create_wallet_json
- id = Zold::JsonPage.new(json).to_hash['id']
- stub_request(:get, "http://localhost:4096/wallet/#{id}/size").to_return(status: 200, body: '10000')
+ hash = Zold::JsonPage.new(json).to_hash
+ id = hash['id']
stub_request(:get, "http://localhost:4096/wallet/#{id}").to_return(status: 200, body: json)
+ stub_request(:get, "http://localhost:4096/wallet/#{id}.bin").to_return(status: 200, body: hash['body'])
Zold::Pull.new(wallets: home.wallets, remotes: remotes, copies: home.copies.root.to_s, log: test_log).run(
['--ignore-this-stupid-option', 'pull', id.to_s, '--tolerate-edges', '--tolerate-quorum=1']
)
home.wallets.acq(Zold::Id.new(id)) do |wallet|
assert(wallet.exists?)
@@ -53,12 +54,13 @@
def test_fails_when_only_edge_nodes
FakeHome.new(log: test_log).run do |home|
remotes = home.remotes
remotes.add('localhost', 4096)
json = home.create_wallet_json
- id = Zold::JsonPage.new(json).to_hash['id']
- stub_request(:get, "http://localhost:4096/wallet/#{id}/size").to_return(status: 200, body: '10000')
+ hash = Zold::JsonPage.new(json).to_hash
+ id = hash['id']
stub_request(:get, "http://localhost:4096/wallet/#{id}").to_return(status: 200, body: json)
+ stub_request(:get, "http://localhost:4096/wallet/#{id}.bin").to_return(status: 200, body: hash['body'])
assert_raises Zold::Fetch::EdgesOnly do
Zold::Pull.new(wallets: home.wallets, remotes: remotes, copies: home.copies.root.to_s, log: test_log).run(
['--ignore-this-stupid-option', 'pull', id.to_s]
)
end