1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[aws|compute] move images specs to tests

This commit is contained in:
geemus 2010-09-28 15:27:28 -07:00
parent fbcc8dd6e4
commit b3a25e8808
2 changed files with 41 additions and 44 deletions

View file

@ -1,44 +0,0 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Compute.describe_images' do
describe 'success' do
it "should return proper attributes with no params" do
actual = AWS[:compute].describe_images
actual.body['requestId'].should be_a(String)
image = actual.body['imagesSet'].first
image['architecture'].should be_a(String)
image['imageId'].should be_a(String)
image['imageLocation'].should be_a(String)
image['imageOwnerId'].should be_a(String)
image['imageState'].should be_a(String)
image['imageType'].should be_a(String)
[false, true].should include(image['isPublic'])
image['kernelId'].should be_a(String) if image['kernelId']
image['platform'].should be_a(String) if image['platform']
image['ramdiskId'].should be_a(String) if image['ramdiskId']
image['rootDeviceName'].should be_a(String) if image['rootDeviceName']
["ebs","instance-store"].should include(image['rootDeviceType'])
image['rootDeviceName'].should be_a(String) if image['rootDeviceName']
end
it "should return proper attributes with params" do
actual = AWS[:compute].describe_images('ImageId' => GENTOO_AMI)
actual.body['requestId'].should be_a(String)
image = actual.body['imagesSet'].first
image['architecture'].should be_a(String)
image['imageId'].should be_a(String)
image['imageLocation'].should be_a(String)
image['imageOwnerId'].should be_a(String)
image['imageState'].should be_a(String)
image['imageType'].should be_a(String)
[false, true].should include(image['isPublic'])
image['kernelId'].should be_a(String) if image['kernelId']
image['platform'].should be_a(String) if image['platform']
image['ramdiskId'].should be_a(String) if image['ramdiskId']
["ebs","instance-store"].should include(image['rootDeviceType'])
image['rootDeviceName'].should be_a(String) if image['rootDeviceName']
end
end
end

View file

@ -0,0 +1,41 @@
Shindo.tests('AWS::Compute | image requests', ['aws']) do
@images_format = {
'imagesSet' => [{
'architecture' => String,
'blockDeviceMapping' =>[],
'imageId' => String,
'imageLocation' => String,
'imageOwnerId' => String,
'imageState' => String,
'imageType' => String,
'isPublic' => Fog::Boolean,
'kernelId' => String,
'productCodes' => [],
'ramdiskId' => String,
'rootDeviceType' => String
}],
'requestId' => String,
}
tests('success') do
# the result for this is HUGE an relatively uninteresting...de
# tests("#describe_images").formats(@images_format) do
# AWS[:compute].describe_images.body
# end
tests("#describe_images('ImageId' => '#{GENTOO_AMI}')").formats(@images_format) do
AWS[:compute].describe_images('ImageId' => GENTOO_AMI).body
end
end
tests('failure') do
tests("#describe_images('ImageId' => 'ami-00000000')").raises(Fog::AWS::Compute::Error) do
AWS[:compute].describe_regions('ImageId' => 'ami-00000000')
end
end
end