From 05bf79abc73575a963efa96353a3f623dfafb520 Mon Sep 17 00:00:00 2001 From: Tzu-Mainn Chen Date: Tue, 11 Jul 2017 22:11:55 +0200 Subject: [PATCH] Update keypair spec test Fixes issue caused by changes in https://github.com/ManageIQ/manageiq/pull/15485 --- .../cloud_manager/auth_key_pair_spec.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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