1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

tests for scp_download

This commit is contained in:
Christoph Schiessl 2011-12-18 22:08:49 +01:00
parent 0e94c25929
commit 44c96e5c15

View file

@ -44,17 +44,29 @@ Shindo.tests('compute examples', 'compute') do
# scp a file to a server # scp a file to a server
lorem_path = File.join([File.dirname(__FILE__), '..', 'tests', 'lorem.txt']) lorem_path = File.join([File.dirname(__FILE__), '..', 'tests', 'lorem.txt'])
tests("@server.scp('#{lorem_path}', 'lorem.txt')").succeeds do tests("@server.scp_upload('#{lorem_path}', 'lorem.txt')").succeeds do
@server.scp(lorem_path, 'lorem.txt') @server.scp_upload(lorem_path, 'lorem.txt')
end end
# scp a file from a server
tests("@server.scp_download('lorem.txt', '/tmp/lorem.txt)").succeeds do
@server.scp_download('lorem.txt', '/tmp/lorem.txt')
end
File.delete('/tmp/lorem.txt')
# scp a directory to a server # scp a directory to a server
Dir.mkdir('/tmp/lorem') Dir.mkdir('/tmp/lorem')
file = ::File.new('/tmp/lorem/lorem.txt', 'w') file = ::File.new('/tmp/lorem/lorem.txt', 'w')
file.write(File.read(lorem_path)) file.write(File.read(lorem_path))
lorem_dir = File.join([File.dirname(__FILE__), '..', 'tests']) tests("@server.scp_upload('/tmp/lorem', '/tmp', :recursive => true)").succeeds do
tests("@server.scp('#{lorem_dir}', '/tmp/lorem', :recursive => true)").succeeds do @server.scp_upload('/tmp/lorem', '/tmp', :recursive => true)
@server.scp(lorem_dir, '/tmp/lorem', :recursive => true) end
File.delete('/tmp/lorem/lorem.txt')
Dir.rmdir('/tmp/lorem')
# scp a directory from a server
tests("@server.scp_download('/tmp/lorem', '/tmp', :recursive => true)").succeeds do
@server.scp_download('/tmp/lorem', '/tmp', :recursive => true)
end end
File.delete('/tmp/lorem/lorem.txt') File.delete('/tmp/lorem/lorem.txt')
Dir.rmdir('/tmp/lorem') Dir.rmdir('/tmp/lorem')