diff --git a/spec/models/manageiq/providers/openstack/cloud_manager/auth_key_pair_spec.rb b/spec/models/manageiq/providers/openstack/cloud_manager/auth_key_pair_spec.rb index bd1bde061..498809e58 100644 --- a/spec/models/manageiq/providers/openstack/cloud_manager/auth_key_pair_spec.rb +++ b/spec/models/manageiq/providers/openstack/cloud_manager/auth_key_pair_spec.rb @@ -1,6 +1,18 @@ describe ManageIQ::Providers::Openstack::CloudManager::AuthKeyPair do let(:ems) { FactoryGirl.create(:ems_openstack_with_authentication) } - let(:key_pair_attributes) { {:name => "key1", :public_key => "AAA...B"} } + let(:key_pair_attributes) { { + :name => "key1", + :fingerprint => "0000", + :public_key => "AAA...B", + :private_key => "BBB...C"} } + let(:the_raw_key_pair) do + double.tap do |key_pair| + allow(key_pair).to receive(:name).and_return('key1') + allow(key_pair).to receive(:fingerprint).and_return('0000') + allow(key_pair).to receive(:public_key).and_return('AAA...B') + allow(key_pair).to receive(:private_key).and_return('BBB...C') + end + end describe 'key pair create and delete' do it 'creates new key pair in nova' do @@ -10,7 +22,7 @@ allow(ems).to receive(:connect).with(:service => 'Compute').and_return(service) allow(service).to receive(:key_pairs).and_return(key_pairs) allow(key_pairs).to receive(:create).with(key_pair_attributes).and_return( - FactoryGirl.create :auth_key_pair_openstack) + the_raw_key_pair) subject.class.create_key_pair(ems.id, key_pair_attributes) end