test/commands/test_remote.rb in zold-0.14.22 vs test/commands/test_remote.rb in zold-0.14.23
- old
+ new
@@ -92,25 +92,27 @@
end
def test_remote_trim_with_tolerate
Dir.mktmpdir do |dir|
remotes = Zold::Remotes.new(file: File.join(dir, 'remotes.txt'))
- zero = Zold::Score::ZERO
- stub_request(:get, "http://#{zero.host}:#{zero.port}/remotes").to_return(
+ score = Zold::Score.new(
+ time: Time.now, host: 'aa1.example.org', port: 9999, invoice: 'NOPREFIX4@ffffffffffffffff'
+ )
+ stub_request(:get, "http://#{score.host}:#{score.port}/remotes").to_return(
status: 200,
body: {
version: Zold::VERSION,
- score: zero.to_h,
+ score: score.to_h,
all: [
{ host: 'localhost', port: 8883 }
]
}.to_json
)
stub_request(:get, 'http://localhost:8883/remotes').to_return(status: 404)
cmd = Zold::Remote.new(remotes: remotes, log: test_log)
cmd.run(%w[remote clean])
assert(remotes.all.empty?)
- cmd.run(['remote', 'add', zero.host, zero.port.to_s, '--skip-ping'])
+ cmd.run(['remote', 'add', score.host, score.port.to_s, '--skip-ping'])
cmd.run(['remote', 'update', '--ignore-score-weakness', '--skip-ping'])
assert_equal(2, remotes.all.count)
cmd.run(['remote', 'update', '--ignore-score-weakness'])
cmd.run(['remote', 'trim', '--tolerate=0'])
assert_equal(1, remotes.all.count)