2010-01-26 08:01:17 +00:00
|
|
|
require File.join(File.dirname(__FILE__), '..', 'test_helper')
|
|
|
|
|
|
|
|
class SshTest < Test::Unit::TestCase
|
|
|
|
|
|
|
|
context "Hobo ssh" do
|
|
|
|
setup do
|
|
|
|
@handler = Hobo::SSH
|
|
|
|
@script = Hobo::SSH::SCRIPT
|
2010-01-30 06:39:45 +00:00
|
|
|
Hobo.config!(hobo_mock_config)
|
2010-01-26 08:01:17 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test "should call exec with defaults when no options are supplied" do
|
2010-01-30 04:38:36 +00:00
|
|
|
ssh = hobo_mock_config[:ssh]
|
2010-01-27 04:49:22 +00:00
|
|
|
Kernel.expects(:exec).with("#{@script} #{ssh[:uname]} #{ssh[:pass]} #{ssh[:host]} #{ssh[:port]}")
|
2010-01-26 08:01:17 +00:00
|
|
|
Hobo::SSH.connect
|
|
|
|
end
|
|
|
|
|
|
|
|
test "should call exec with supplied params" do
|
2010-01-27 04:49:22 +00:00
|
|
|
args = {:uname => 'bar', :pass => 'baz', :host => 'bak', :port => 'bag'}
|
|
|
|
Kernel.expects(:exec).with("#{@script} #{args[:uname]} #{args[:pass]} #{args[:host]} #{args[:port]}")
|
2010-01-26 08:01:17 +00:00
|
|
|
Hobo::SSH.connect(args)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|