mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
tweaking shindo usage as I solidify how I want to use it
This commit is contained in:
parent
0557b1625e
commit
d64526c841
32 changed files with 242 additions and 94 deletions
57
tests/aws/helper.rb
Normal file
57
tests/aws/helper.rb
Normal file
|
@ -0,0 +1,57 @@
|
|||
# Boolean hax
|
||||
module Fog
|
||||
module Boolean
|
||||
end
|
||||
end
|
||||
FalseClass.send(:include, Fog::Boolean)
|
||||
TrueClass.send(:include, Fog::Boolean)
|
||||
|
||||
module AWS
|
||||
|
||||
class << self
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials.reject do |k, v|
|
||||
![:aws_access_key_id, :aws_secret_access_key].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :ec2
|
||||
Fog::AWS::EC2.new(credentials)
|
||||
when :eu_s3
|
||||
Fog::AWS::S3.new(credentials.merge!(:host => 's3-external-3.amazonaws.com'))
|
||||
when :sdb
|
||||
Fog::AWS::SimpleDB.new(credentials)
|
||||
when :s3
|
||||
Fog::AWS::S3.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
end
|
||||
|
||||
module EC2
|
||||
|
||||
module Formats
|
||||
|
||||
ADDRESSES = {
|
||||
'addressesSet' => [{
|
||||
'instanceId' => NilClass,
|
||||
'publicIp' => String
|
||||
}],
|
||||
'requestId' => String
|
||||
}
|
||||
|
||||
BASIC = {
|
||||
'requestId' => String,
|
||||
'return' => ::Fog::Boolean
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
unless defined?(GENTOO_AMI)
|
||||
GENTOO_AMI = 'ami-5ee70037'
|
||||
end
|
91
tests/aws/requests/ec2/addresses_tests.rb
Normal file
91
tests/aws/requests/ec2/addresses_tests.rb
Normal file
|
@ -0,0 +1,91 @@
|
|||
Shindo.tests('AWS::EC2', ['aws']) do
|
||||
|
||||
@server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
|
||||
@server.wait_for { ready? }
|
||||
|
||||
tests('success') do
|
||||
|
||||
@public_ip = nil
|
||||
|
||||
test('#allocate_address') do
|
||||
@data = AWS[:ec2].allocate_address.body
|
||||
@public_ip = @data['publicIp']
|
||||
has_format(
|
||||
@data,
|
||||
{
|
||||
'publicIp' => String,
|
||||
'requestId' => String
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
test("#describe_addresses") do
|
||||
@data = AWS[:ec2].describe_addresses.body
|
||||
has_format(@data, AWS::EC2::Formats::ADDRESSES)
|
||||
end
|
||||
|
||||
test("#describe_addresses('#{@public_ip}')") do
|
||||
@data = AWS[:ec2].describe_addresses(@public_ip).body
|
||||
has_format(@data, AWS::EC2::Formats::ADDRESSES)
|
||||
end
|
||||
|
||||
test("#associate_address('#{@server.identity}', '#{@public_ip}')") do
|
||||
@data = AWS[:ec2].associate_address(@server.identity, @public_ip).body
|
||||
has_format(@data, AWS::EC2::Formats::BASIC)
|
||||
end
|
||||
|
||||
test("#disassociate_address('#{@public_ip}')") do
|
||||
@data = AWS[:ec2].disassociate_address(@public_ip).body
|
||||
has_format(@data, AWS::EC2::Formats::BASIC)
|
||||
end
|
||||
|
||||
test("#release_address('#{@public_ip}')") do
|
||||
@data = AWS[:ec2].release_address(@public_ip).body
|
||||
has_format(@data, AWS::EC2::Formats::BASIC)
|
||||
end
|
||||
|
||||
end
|
||||
tests ('failure') do
|
||||
|
||||
@address = AWS[:ec2].addresses.create
|
||||
|
||||
test("#describe_addresses('127.0.0.1') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].describe_addresses('127.0.0.1')
|
||||
end
|
||||
end
|
||||
|
||||
test("#associate_addresses('i-00000000', '#{@address.identity}') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].associate_address('i-00000000', @address.identity)
|
||||
end
|
||||
end
|
||||
|
||||
test("#associate_addresses('#{@server.identity}', '127.0.0.1') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].associate_address(@server.identity, '127.0.0.1')
|
||||
end
|
||||
end
|
||||
|
||||
test("#disassociate_addresses('127.0.0.1') raises BadRequest error") do
|
||||
begin
|
||||
AWS[:ec2].disassociate_address('127.0.0.1')
|
||||
false
|
||||
rescue Excon::Errors::BadRequest
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
test("#release_address('127.0.0.1') raises BadRequest error") do
|
||||
has_error(Excon::Errors::BadRequest) do
|
||||
AWS[:ec2].release_address('127.0.0.1')
|
||||
end
|
||||
end
|
||||
|
||||
@address.destroy
|
||||
|
||||
end
|
||||
|
||||
@server.destroy
|
||||
|
||||
end
|
|
@ -1,8 +1,22 @@
|
|||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'fog'))
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'fog', 'bin'))
|
||||
|
||||
if ENV["FOG_MOCK"] == "true"
|
||||
Fog.mock!
|
||||
end
|
||||
|
||||
def has_error(description, error, &block)
|
||||
begin
|
||||
yield
|
||||
@formatador.display_line("[red]did not raise #{error}[/]")
|
||||
false
|
||||
rescue error
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: Currently is true even if some of the keys in format do not appear
|
||||
def validate_format(original_data, format)
|
||||
def has_format(original_data, format)
|
||||
valid = true
|
||||
data = original_data.dup
|
||||
for key, value in format
|
||||
|
@ -14,14 +28,14 @@ def validate_format(original_data, format)
|
|||
for element in datum
|
||||
type = value.first
|
||||
if type.is_a?(Hash)
|
||||
valid &&= validate_format({:element => element}, {:element => type})
|
||||
valid &&= has_format({:element => element}, {:element => type})
|
||||
else
|
||||
valid &&= element.is_a?(type)
|
||||
end
|
||||
end
|
||||
when Hash
|
||||
valid &&= datum.is_a?(Hash)
|
||||
valid &&= validate_format(datum, value)
|
||||
valid &&= has_format(datum, value)
|
||||
else
|
||||
valid &&= datum.is_a?(value)
|
||||
end
|
||||
|
|
|
@ -1,18 +1,48 @@
|
|||
Shindo.tests('test_helper', 'meta') do
|
||||
tests('#validate_data_format') do
|
||||
|
||||
tests('#has_error') do
|
||||
|
||||
tests('returns true') do
|
||||
|
||||
test('when expected error is raised') do
|
||||
has_error(StandardError) { raise StandardError.new }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('returns false') do
|
||||
|
||||
test('when no error is raised') do
|
||||
!has_error(StandardError) {}
|
||||
end
|
||||
|
||||
test('when a different error is raised') do
|
||||
begin
|
||||
!has_error(StandardError) { raise Interrupt.new }
|
||||
false
|
||||
rescue Interrupt
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
tests('#has_format') do
|
||||
|
||||
tests('returns true') do
|
||||
|
||||
test('when format of value matches') do
|
||||
validate_format({:a => :b}, {:a => Symbol})
|
||||
has_format({:a => :b}, {:a => Symbol})
|
||||
end
|
||||
|
||||
test('when format of nested array elements matches') do
|
||||
validate_format({:a => [:b, :c]}, {:a => [Symbol]})
|
||||
has_format({:a => [:b, :c]}, {:a => [Symbol]})
|
||||
end
|
||||
|
||||
test('when format of nested hash matches') do
|
||||
validate_format({:a => {:b => :c}}, {:a => {:b => Symbol}})
|
||||
has_format({:a => {:b => :c}}, {:a => {:b => Symbol}})
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -20,18 +50,19 @@ Shindo.tests('test_helper', 'meta') do
|
|||
tests('returns false') do
|
||||
|
||||
test('when format of value does not match') do
|
||||
!validate_format({:a => :b}, {:a => String})
|
||||
!has_format({:a => :b}, {:a => String})
|
||||
end
|
||||
|
||||
test('when not all keys are checked') do
|
||||
!validate_format({:a => :b}, {})
|
||||
!has_format({:a => :b}, {})
|
||||
end
|
||||
|
||||
test('when some keys do not appear') do
|
||||
!validate_format({}, {:a => String})
|
||||
!has_format({}, {:a => String})
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ Shindo.tests('Rackspace::Servers#create_image', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Rackspace::Servers::Formats::IMAGE)
|
||||
has_format(@data, Rackspace::Servers::Formats::IMAGE)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ Shindo.tests('Rackspace::Servers#create_server', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Rackspace::Servers::Formats::SERVER.merge('adminPass' => String))
|
||||
has_format(@data, Rackspace::Servers::Formats::SERVER.merge('adminPass' => String))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -20,11 +20,8 @@ Shindo.tests('Rackspace::Servers#delete_image', 'rackspace') do
|
|||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if image does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].delete_image(0)
|
||||
false
|
||||
rescue Excon::Errors::NotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -14,11 +14,8 @@ Shindo.tests('Rackspace::Servers#delete_server', 'rackspace') do
|
|||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].delete_server(0)
|
||||
false
|
||||
rescue Excon::Errors::NotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,18 +6,15 @@ Shindo.tests('Rackspace::Servers#get_flavor_details', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Rackspace::Servers::Formats::FLAVOR)
|
||||
has_format(@data, Rackspace::Servers::Formats::FLAVOR)
|
||||
end
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if flavor does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].get_flavor_details(0)
|
||||
false
|
||||
rescue Excon::Errors::NotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,18 +6,15 @@ Shindo.tests('Rackspace::Servers#get_image_details', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Rackspace::Servers::Formats::IMAGE)
|
||||
has_format(@data, Rackspace::Servers::Formats::IMAGE)
|
||||
end
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if image does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].get_image_details(0)
|
||||
false
|
||||
rescue Excon::Errors::NotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,18 +12,15 @@ Shindo.tests('Rackspace::Servers#get_server_details', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Rackspace::Servers::Formats::SERVER)
|
||||
has_format(@data, Rackspace::Servers::Formats::SERVER)
|
||||
end
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].get_server_details(0)
|
||||
false
|
||||
rescue Excon::Errors::NotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,18 +12,15 @@ Shindo.tests('Rackspace::Servers#list_addresses', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, {'private' => [String], 'public' => [String]})
|
||||
has_format(@data, {'private' => [String], 'public' => [String]})
|
||||
end
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].list_addresses(0)
|
||||
false
|
||||
rescue Excon::Errors::NotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ Shindo.tests('Rackspace::Servers#list_flavors_detail', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, [Rackspace::Servers::Formats::FLAVOR])
|
||||
has_format(@data, [Rackspace::Servers::Formats::FLAVOR])
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ Shindo.tests('Rackspace::Servers#list_flavors', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Rackspace::Servers::Formats::SUMMARY)
|
||||
has_format(@data, Rackspace::Servers::Formats::SUMMARY)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ Shindo.tests('Rackspace::Servers#list_images_detail', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Rackspace::Servers::Formats::IMAGE)
|
||||
has_format(@data, Rackspace::Servers::Formats::IMAGE)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ Shindo.tests('Rackspace::Servers#list_images', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Rackspace::Servers::Formats::SUMMARY)
|
||||
has_format(@data, Rackspace::Servers::Formats::SUMMARY)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -12,18 +12,15 @@ Shindo.tests('Rackspace::Servers#list_private_addresses', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, [String])
|
||||
has_format(@data, [String])
|
||||
end
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].list_private_addresses(0)
|
||||
false
|
||||
rescue Excon::Errors::NotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,18 +12,15 @@ Shindo.tests('Rackspace::Servers#list_public_addresses', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, [String])
|
||||
has_format(@data, [String])
|
||||
end
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].list_public_addresses(0)
|
||||
false
|
||||
rescue Excon::Errors::NotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ Shindo.tests('Rackspace::Servers#list_servers_detail', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Rackspace::Servers::Formats::SERVER)
|
||||
has_format(@data, Rackspace::Servers::Formats::SERVER)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ Shindo.tests('Rackspace::Servers#list_servers', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Rackspace::Servers::Formats::SUMMARY)
|
||||
has_format(@data, Rackspace::Servers::Formats::SUMMARY)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -28,11 +28,8 @@ Shindo.tests('Rackspace::Servers#reboot_server', 'rackspace') do
|
|||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].reboot_server(0)
|
||||
false
|
||||
rescue Excon::Errors::NotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,18 +12,15 @@ Shindo.tests('Rackspace::Servers#update_server', 'rackspace') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, {'name' => String, 'adminPass' => String})
|
||||
has_format(@data, {'name' => String, 'adminPass' => String})
|
||||
end
|
||||
|
||||
end
|
||||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if server does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Rackspace[:servers].update_server(0, :name => 'fogupdatedserver', :adminPass => 'fogupdatedserver')
|
||||
false
|
||||
rescue Excon::Errors::NotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ Shindo.tests('Slicehost#create_slice', 'slicehost') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Slicehost::Formats::SLICE.merge('root-password' => String))
|
||||
has_format(@data, Slicehost::Formats::SLICE.merge('root-password' => String))
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -16,11 +16,8 @@ Shindo.tests('Slicehost#delete_slice', 'slicehost') do
|
|||
tests('failure') do
|
||||
|
||||
test('raises NotFound error if slice does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::NotFound) do
|
||||
Slicehost[:slices].delete_slice(0)
|
||||
false
|
||||
rescue Excon::Errors::NotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ Shindo.tests('Slicehost#get_backups', 'slicehost') do
|
|||
|
||||
# TODO: ensure this still works with a non-empty list
|
||||
test('has proper output format') do
|
||||
validate_format(@data, { 'backups' => [Slicehost::Formats::BACKUP] })
|
||||
has_format(@data, { 'backups' => [Slicehost::Formats::BACKUP] })
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ Shindo.tests('Slicehost#get_flavor', 'slicehost') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Slicehost::Formats::FLAVOR)
|
||||
has_format(@data, Slicehost::Formats::FLAVOR)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -14,11 +14,8 @@ Shindo.tests('Slicehost#get_flavor', 'slicehost') do
|
|||
tests('failure') do
|
||||
|
||||
test('raises Forbidden error if flavor does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::Forbidden) do
|
||||
Slicehost[:slices].get_flavor(0)
|
||||
false
|
||||
rescue Excon::Errors::Forbidden
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ Shindo.tests('Slicehost#get_flavors', 'slicehost') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, { 'flavors' => [Slicehost::Formats::FLAVOR] })
|
||||
has_format(@data, { 'flavors' => [Slicehost::Formats::FLAVOR] })
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ Shindo.tests('Slicehost#get_image', 'slicehost') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Slicehost::Formats::IMAGE)
|
||||
has_format(@data, Slicehost::Formats::IMAGE)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -14,11 +14,8 @@ Shindo.tests('Slicehost#get_image', 'slicehost') do
|
|||
tests('failure') do
|
||||
|
||||
test('raises Forbidden error if flavor does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::Forbidden)
|
||||
Slicehost[:slices].get_image(0)
|
||||
false
|
||||
rescue Excon::Errors::Forbidden
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ Shindo.tests('Slicehost#get_images', 'slicehost') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, { 'images' => [Slicehost::Formats::IMAGE] })
|
||||
has_format(@data, { 'images' => [Slicehost::Formats::IMAGE] })
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ Shindo.tests('Slicehost#get_slice', 'slicehost') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Slicehost::Formats::SLICE)
|
||||
has_format(@data, Slicehost::Formats::SLICE)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -21,11 +21,8 @@ Shindo.tests('Slicehost#get_slice', 'slicehost') do
|
|||
tests('failure') do
|
||||
|
||||
test('raises Forbidden error if flavor does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::Forbidden)
|
||||
Slicehost[:slices].get_slice(0)
|
||||
false
|
||||
rescue Excon::Errors::Forbidden
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ Shindo.tests('Slicehost#get_slices', 'slicehost') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, { 'slices' => [Slicehost::Formats::SLICE] })
|
||||
has_format(@data, { 'slices' => [Slicehost::Formats::SLICE] })
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ Shindo.tests('Slicehost#reboot_slice', 'slicehost') do
|
|||
end
|
||||
|
||||
test('has proper output format') do
|
||||
validate_format(@data, Slicehost::Formats::SLICE)
|
||||
has_format(@data, Slicehost::Formats::SLICE)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -22,11 +22,8 @@ Shindo.tests('Slicehost#reboot_slice', 'slicehost') do
|
|||
tests('failure') do
|
||||
|
||||
test('raises Forbidden error if flavor does not exist') do
|
||||
begin
|
||||
has_error(Excon::Errors::Forbidden) do
|
||||
Slicehost[:slices].reboot_slice(0)
|
||||
false
|
||||
rescue Excon::Errors::Forbidden
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue