diff --git a/lib/fog/rackspace/models/compute_v2/keypair.rb b/lib/fog/rackspace/models/compute_v2/keypair.rb index 8854fb1ad..0694aa621 100644 --- a/lib/fog/rackspace/models/compute_v2/keypair.rb +++ b/lib/fog/rackspace/models/compute_v2/keypair.rb @@ -18,11 +18,8 @@ module Fog end def destroy - begin service.delete_keypair(identity) - rescue Fog::Compute::RackspaceV2::NotFound - end - true + true end end diff --git a/lib/fog/rackspace/models/compute_v2/keypairs.rb b/lib/fog/rackspace/models/compute_v2/keypairs.rb index ece51bd31..ba2f366b0 100644 --- a/lib/fog/rackspace/models/compute_v2/keypairs.rb +++ b/lib/fog/rackspace/models/compute_v2/keypairs.rb @@ -18,11 +18,7 @@ module Fog end def get(key_id) - begin new(service.get_keypair(key_id).body['keypair']) - rescue Fog::Compute::RackspaceV2::NotFound - nil - end end end diff --git a/tests/rackspace/models/compute_v2/keypairs_tests.rb b/tests/rackspace/models/compute_v2/keypairs_tests.rb index 6afdd76be..b9fbd2bbe 100644 --- a/tests/rackspace/models/compute_v2/keypairs_tests.rb +++ b/tests/rackspace/models/compute_v2/keypairs_tests.rb @@ -22,11 +22,11 @@ Shindo.tests('Fog::Compute::RackspaceV2 | keypairs', ['rackspace']) do end tests('failure') do - tests("unknown_get").returns(nil) do + tests("unknown_get").raises(Fog::Compute::RackspaceV2::NotFound) do service.keypairs.get(Fog::Mock.random_letters(32)) end - tests("unknown_delete").returns(true) do + tests("unknown_delete").raises(Fog::Compute::RackspaceV2::NotFound) do service.keypairs.destroy(Fog::Mock.random_letters(32)) end end