require File.dirname(__FILE__) + '/test_helper' class TransferTest < Test::Unit::TestCase def setup @path = "/tmp/astrovan.#{Time.now.to_i}" super end def teardown system "rm -rf #{@path}.from #{@path}.to" super end def test_should_put_data_into_file data = Time.now.utc.to_s to = "#{@path}.to" using 'astrovan.local', :password => ENV['PASSWORD'], :data => data, :to => to do put data, :to => to end assert_equal data, File.open(to) { |f| f.gets.chomp } end def test_should_upload_file data = Time.now.utc.to_s from = "#{@path}.from" to = "#{@path}.to" File.open(from, "w") { |f| f.puts data } using 'astrovan.local', :password => ENV['PASSWORD'], :from => from, :to => to do upload from, :to => to end assert_equal data, File.open(to) { |f| f.gets.chomp } end end