mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
rackspace: keypairs - throw Fog::Compute::RackspaceV2::NotFound when HTTP:404 received
This commit is contained in:
parent
b208e9df4a
commit
3f76904905
3 changed files with 3 additions and 10 deletions
|
@ -18,11 +18,8 @@ module Fog
|
|||
end
|
||||
|
||||
def destroy
|
||||
begin
|
||||
service.delete_keypair(identity)
|
||||
rescue Fog::Compute::RackspaceV2::NotFound
|
||||
end
|
||||
true
|
||||
true
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue