3 When /^I (wget|curl) "([^"]+)" to stdout(?:| with the '([^']+)' options)$/ do |cmd, target, options|
5 if target == 'some Tails mirror'
6 host = 'dl.amnesia.boum.org'
7 address = Resolv.new.getaddresses(host).sample
8 puts "Resolved #{host} to #{address}"
9 url = "http://#{address}/tails/stable/"
13 arguments = if cmd == 'wget'
18 arguments = "#{options} #{arguments}" if options
19 @vm_execute_res = $vm.execute("#{cmd} #{arguments}", user: LIVE_USER)
20 if @vm_execute_res.failure?
21 raise "#{cmd}:ing #{url} with options #{options} failed with:\n" \
22 "#{@vm_execute_res.stdout}\n" +
23 @vm_execute_res.stderr.to_s
28 Then /^the (wget|curl) command is successful$/ do |cmd|
30 @vm_execute_res.success?,
32 "#{@vm_execute_res.stdout}\n" +
33 @vm_execute_res.stderr.to_s
37 Then /^the (wget|curl) standard output contains "([^"]+)"$/ do |cmd, text|
39 @vm_execute_res.stdout[text],
40 "The #{cmd} standard output does not contain #{text}:\n" \
41 "#{@vm_execute_res.stdout}\n" +
42 @vm_execute_res.stderr.to_s