mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[ec2] update mocks/tests to match new error style
This commit is contained in:
parent
9bd2cc39df
commit
14f91dabfa
25 changed files with 40 additions and 40 deletions
lib/fog/aws/requests/ec2
associate_address.rbattach_volume.rbauthorize_security_group_ingress.rbdelete_security_group.rbdelete_snapshot.rbdelete_volume.rbdescribe_addresses.rbdescribe_instances.rbdescribe_key_pairs.rbdescribe_security_groups.rbdescribe_snapshots.rbdescribe_volumes.rbdetach_volume.rbget_console_output.rbreboot_instances.rbrevoke_security_group_ingress.rbterminate_instances.rb
tests
aws/requests/ec2
address_tests.rbavailability_zone_tests.rbkey_pair_tests.rbregion_tests.rbsecurity_group_tests.rbsnapshot_tests.rbvolume_tests.rb
rackspace/requests/servers
|
@ -45,7 +45,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
elsif !instance
|
||||
raise Fog::AWS::EC2::Error.new("InvalidInstanceID.NotFound => The instance ID '#{instance_id}' does not exist")
|
||||
raise Fog::AWS::EC2::NotFound.new("The instance ID '#{instance_id}' does not exist")
|
||||
elsif !address
|
||||
raise Fog::AWS::EC2::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.")
|
||||
end
|
||||
|
|
|
@ -56,9 +56,9 @@ module Fog
|
|||
}.merge!(data)
|
||||
response
|
||||
elsif !instance
|
||||
raise Fog::AWS::EC2::Error.new("InvalidInstanceID.NotFound => The instance ID '#{instance_id}' does not exist.")
|
||||
raise Fog::AWS::EC2::NotFound.new("The instance ID '#{instance_id}' does not exist.")
|
||||
elsif !volume
|
||||
raise Fog::AWS::EC2::Error.new("InvalidVolume.NotFound => The volume '#{volume_id}' does not exist.")
|
||||
raise Fog::AWS::EC2::NotFound.new("The volume '#{volume_id}' does not exist.")
|
||||
end
|
||||
else
|
||||
message = 'MissingParameter => '
|
||||
|
|
|
@ -76,7 +76,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidGroup.NotFound => The security group '#{options['GroupName']}' does not exist")
|
||||
raise Fog::AWS::EC2::NotFound.new("The security group '#{options['GroupName']}' does not exist")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidGroup.NotFound => The security group '#{name}' does not exist")
|
||||
raise Fog::AWS::EC2::NotFound.new("The security group '#{name}' does not exist")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidSnapshot.NotFound => The snapshot '#{snapshot_id}' does not exist.")
|
||||
raise Fog::AWS::EC2::NotFound.new("The snapshot '#{snapshot_id}' does not exist.")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidVolume.NotFound => The volume '#{volume_id}' does not exist.")
|
||||
raise Fog::AWS::EC2::NotFound.new("The volume '#{volume_id}' does not exist.")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidAddress.NotFound => Address #{public_ip.inspect} not found.")
|
||||
raise Fog::AWS::EC2::NotFound.new("Address #{public_ip.inspect} not found.")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidInstanceID.NotFound => The instance ID #{instance_id.inspect} does not exist")
|
||||
raise Fog::AWS::EC2::NotFound.new("The instance ID #{instance_id.inspect} does not exist")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidKeyPair.NotFound => The key pair #{key_name.inspect} does not exist")
|
||||
raise Fog::AWS::EC2::NotFound.new("The key pair #{key_name.inspect} does not exist")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidGroup.NotFound => The security group #{group_name.inspect} does not exist")
|
||||
raise Fog::AWS::EC2::NotFound.new("The security group #{group_name.inspect} does not exist")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidSnapshot.NotFound => The snapshot #{snapshot_id.inspect} does not exist.")
|
||||
raise Fog::AWS::EC2::NotFound.new("The snapshot #{snapshot_id.inspect} does not exist.")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidVolume.NotFound => The volume #{volume_id.inspect} does not exist.")
|
||||
raise Fog::AWS::EC2::NotFound.new("The volume #{volume_id.inspect} does not exist.")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ module Fog
|
|||
}.merge!(data)
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidVolume.NotFound => The volume '#{volume_id}' does not exist.")
|
||||
raise Fog::AWS::EC2::NotFound.new("The volume '#{volume_id}' does not exist.")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else;
|
||||
raise Fog::AWS::EC2::Error.new("InvalidInstanceID.NotFound => The instance ID '#{instance_id}' does not exist")
|
||||
raise Fog::AWS::EC2::NotFound.new("The instance ID '#{instance_id}' does not exist")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidInstanceID.NotFound => The instance ID #{instance_id.inspect} does not exist")
|
||||
raise Fog::AWS::EC2::NotFound.new("The instance ID #{instance_id.inspect} does not exist")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ module Fog
|
|||
}
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidGroup.NotFound => The security group '#{options['GroupName']}' does not exist")
|
||||
raise Fog::AWS::EC2::NotFound.new("The security group '#{options['GroupName']}' does not exist")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ module Fog
|
|||
|
||||
response
|
||||
else
|
||||
raise Fog::AWS::EC2::Error.new("InvalidInstanceID.NotFound => The instance ID '#{instance_id}' does not exist")
|
||||
raise Fog::AWS::EC2::NotFound.new("The instance ID '#{instance_id}' does not exist")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -47,11 +47,11 @@ Shindo.tests('AWS::EC2 | address requests', ['aws']) do
|
|||
|
||||
@address = AWS[:ec2].addresses.create
|
||||
|
||||
tests("#describe_addresses('127.0.0.1')").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#describe_addresses('127.0.0.1')").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].describe_addresses('127.0.0.1')
|
||||
end
|
||||
|
||||
tests("#associate_addresses('i-00000000', '#{@address.identity}')").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#associate_addresses('i-00000000', '#{@address.identity}')").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].associate_address('i-00000000', @address.identity)
|
||||
end
|
||||
|
||||
|
@ -59,7 +59,7 @@ Shindo.tests('AWS::EC2 | address requests', ['aws']) do
|
|||
AWS[:ec2].associate_address(@server.identity, '127.0.0.1')
|
||||
end
|
||||
|
||||
tests("#associate_addresses('i-00000000', '127.0.0.1')").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#associate_addresses('i-00000000', '127.0.0.1')").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].associate_address('i-00000000', '127.0.0.1')
|
||||
end
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ Shindo.tests('AWS::EC2 | availability zone requests', ['aws']) do
|
|||
|
||||
tests('failure') do
|
||||
|
||||
tests("#describe_availability_zones('not-a-zone')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].describe_availability_zones('not-a-zone')
|
||||
tests("#describe_availability_zones('us-east-1e')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].describe_availability_zones('us-east-1e')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -48,7 +48,7 @@ Shindo.tests('AWS::EC2 | key pair requests', ['aws']) do
|
|||
AWS[:ec2].create_key_pair(@key_pair.name)
|
||||
end
|
||||
|
||||
tests("#describe_key_pair('not_a_key_name')").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#describe_key_pair('not_a_key_name')").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].describe_key_pairs('not_a_key_name').body
|
||||
end
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ Shindo.tests('AWS::EC2 | region requests', ['aws']) do
|
|||
|
||||
tests('failure') do
|
||||
|
||||
tests("#describe_regions('not-a-region')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].describe_regions('not-a-region')
|
||||
tests("#describe_regions('us-east-2')").raises(Fog::AWS::EC2::Error) do
|
||||
AWS[:ec2].describe_regions('us-east-2')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|||
AWS[:ec2].create_security_group(@security_group.name, @security_group.description)
|
||||
end
|
||||
|
||||
tests("#authorize_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#authorize_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].authorize_security_group_ingress({
|
||||
'FromPort' => 80,
|
||||
'GroupName' => 'not_a_group_name',
|
||||
|
@ -88,7 +88,7 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|||
})
|
||||
end
|
||||
|
||||
tests("#authorize_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#authorize_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].authorize_security_group_ingress({
|
||||
'GroupName' => 'not_a_group_name',
|
||||
'SourceSecurityGroupName' => 'not_a_group_name',
|
||||
|
@ -96,11 +96,11 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|||
})
|
||||
end
|
||||
|
||||
tests("#describe_security_group('not_a_group_name)").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#describe_security_group('not_a_group_name)").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].describe_security_groups('not_a_group_name')
|
||||
end
|
||||
|
||||
tests("#revoke_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#revoke_security_group_ingress({'FromPort' => 80, 'GroupName' => 'not_a_group_name', 'IpProtocol' => 'tcp', 'toPort' => 80})").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].revoke_security_group_ingress({
|
||||
'FromPort' => 80,
|
||||
'GroupName' => 'not_a_group_name',
|
||||
|
@ -109,7 +109,7 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|||
})
|
||||
end
|
||||
|
||||
tests("#revoke_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#revoke_security_group_ingress({'GroupName' => 'not_a_group_name', 'SourceSecurityGroupName' => 'not_a_group_name', 'SourceSecurityGroupOwnerId' => '#{@owner_id}'})").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].revoke_security_group_ingress({
|
||||
'GroupName' => 'not_a_group_name',
|
||||
'SourceSecurityGroupName' => 'not_a_group_name',
|
||||
|
@ -117,7 +117,7 @@ Shindo.tests('AWS::EC2 | security group requests', ['aws']) do
|
|||
})
|
||||
end
|
||||
|
||||
tests("#delete_security_group('not_a_group_name')").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#delete_security_group('not_a_group_name')").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].delete_security_group('not_a_group_name')
|
||||
end
|
||||
|
||||
|
|
|
@ -45,11 +45,11 @@ Shindo.tests('AWS::EC2 | snapshot requests', ['aws']) do
|
|||
end
|
||||
tests ('failure') do
|
||||
|
||||
tests("#describe_snapshot('snap-00000000')").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#describe_snapshot('snap-00000000')").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].describe_snapshots('snap-00000000')
|
||||
end
|
||||
|
||||
tests("#delete_snapshot('snap-00000000')").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#delete_snapshot('snap-00000000')").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].delete_snapshot('snap-00000000')
|
||||
end
|
||||
|
||||
|
|
|
@ -76,23 +76,23 @@ Shindo.tests('AWS::EC2 | volume requests', ['aws']) do
|
|||
|
||||
@volume = AWS[:ec2].volumes.create(:availability_zone => @server.availability_zone, :size => 1)
|
||||
|
||||
tests("#describe_volume('vol-00000000')").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#describe_volume('vol-00000000')").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].describe_volumes('vol-00000000')
|
||||
end
|
||||
|
||||
tests("#attach_volume('i-00000000', '#{@volume.identity}', '/dev/sdh')").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#attach_volume('i-00000000', '#{@volume.identity}', '/dev/sdh')").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].attach_volume('i-00000000', @volume.identity, '/dev/sdh')
|
||||
end
|
||||
|
||||
tests("#attach_volume('#{@server.identity}', 'vol-00000000', '/dev/sdh')").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#attach_volume('#{@server.identity}', 'vol-00000000', '/dev/sdh')").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].attach_volume(@server.identity, 'vol-00000000', '/dev/sdh')
|
||||
end
|
||||
|
||||
tests("#detach_volume('vol-00000000')").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#detach_volume('vol-00000000')").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].detach_volume('vol-00000000')
|
||||
end
|
||||
|
||||
tests("#delete_volume('vol-00000000')").raises(Fog::AWS::EC2::Error) do
|
||||
tests("#delete_volume('vol-00000000')").raises(Fog::AWS::EC2::NotFound) do
|
||||
AWS[:ec2].delete_volume('vol-00000000')
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Shindo.tests('Rackspace::Servers#list_images_detail', 'rackspace') do
|
||||
tests('success') do
|
||||
|
||||
tests('#list_images_detail').formats({'images' => [Rackspace::Servers::Formats::IMAGE]})
|
||||
tests('#list_images_detail').formats({'images' => [Rackspace::Servers::Formats::IMAGE]}) do
|
||||
Rackspace[:servers].list_images_detail.body
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue