Updated the tests for ssh key support in linux

This commit is contained in:
Mukta 2013-05-16 18:47:43 +05:30
Родитель 1f8bb53dba
Коммит d8c632cdd9
1 изменённых файлов: 24 добавлений и 19 удалений

Просмотреть файл

@ -168,25 +168,30 @@ describe "for bootstrap protocol ssh:" do
@bootstrap.should_receive(:run)
@server_instance.run
end
it "check if ssh-key set correctly" do
Chef::Config[:knife][:ssh_password] = ''
Chef::Config[:knife][:identity_file] = 'ssh_key'
@server_instance.should_receive(:is_image_windows?).and_return(false)
@server_params = @server_instance.create_server_def
@server_params[:os_type].should == 'Linux'
@server_params[:identity_file].should == 'ssh_key'
@server_params[:ssh_user].should == 'ssh_user'
@server_params[:bootstrap_proto].should == 'ssh'
@server_params[:hosted_service_name].should == 'service001'
end
it "successful bootstrap with ssh key" do
@server_instance.should_receive(:is_image_windows?).exactly(3).times.and_return(false)
@bootstrap = Chef::Knife::Bootstrap.new
Chef::Knife::Bootstrap.stub(:new).and_return(@bootstrap)
@bootstrap.should_receive(:run)
@server_instance.connection.certificates.stub(:generateCertificateData).and_return("cert_data")
@server_instance.connection.certificates.should_receive(:create)
@server_instance.run
context "ssh key" do
before do
Chef::Config[:knife][:ssh_password] = ''
Chef::Config[:knife][:identity_file] = 'ssh_key'
end
it "check if ssh-key set correctly" do
@server_instance.should_receive(:is_image_windows?).and_return(false)
@server_params = @server_instance.create_server_def
@server_params[:os_type].should == 'Linux'
@server_params[:identity_file].should == 'ssh_key'
@server_params[:ssh_user].should == 'ssh_user'
@server_params[:bootstrap_proto].should == 'ssh'
@server_params[:hosted_service_name].should == 'service001'
end
it "successful bootstrap with ssh key" do
@server_instance.should_receive(:is_image_windows?).exactly(3).times.and_return(false)
@bootstrap = Chef::Knife::Bootstrap.new
Chef::Knife::Bootstrap.stub(:new).and_return(@bootstrap)
@bootstrap.should_receive(:run)
@server_instance.connection.certificates.stub(:generateCertificateData).and_return("cert_data")
@server_instance.connection.certificates.should_receive(:create)
@server_instance.run
end
end
context "bootstrap"