1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/spec/aws/models/compute/server_spec.rb

106 lines
2.8 KiB
Ruby
Raw Normal View History

2010-01-08 14:29:07 -05:00
require File.dirname(__FILE__) + '/../../../spec_helper'
2010-09-09 20:50:38 -04:00
describe 'Fog::AWS::Compute::Server' do
2010-01-08 14:29:07 -05:00
subject { @server = @servers.new(:image_id => GENTOO_AMI) }
before(:each) do
2010-09-09 20:50:38 -04:00
@servers = AWS[:compute].servers
end
after(:each) do
if @server && !@server.new_record?
@server.wait_for { ready? }
@server.destroy.should be_true
end
end
2010-01-08 14:29:07 -05:00
describe "#initialize" do
it "should remap attributes from parser" do
server = @servers.new({
2010-01-08 14:29:07 -05:00
'amiLaunchIndex' => 'ami_launch_index',
'clientToken' => 'client_token',
2010-01-08 14:29:07 -05:00
'dnsName' => 'dns_name',
'imageId' => 'image_id',
'instanceId' => 'instance_id',
'instanceType' => 'instance_type',
'kernelId' => 'kernel_id',
'keyName' => 'key_name',
'launchTime' => 'launch_time',
'productCodes' => 'product_codes',
'privateDnsName' => 'private_dns_name',
'ramdiskId' => 'ramdisk_id'
})
server.ami_launch_index.should == 'ami_launch_index'
server.client_token.should == 'client_token'
2010-01-08 14:29:07 -05:00
server.dns_name.should == 'dns_name'
server.image_id.should == 'image_id'
server.id.should == 'instance_id'
server.kernel_id.should == 'kernel_id'
server.key_name.should == 'key_name'
server.created_at.should == 'launch_time'
2010-01-08 14:29:07 -05:00
server.product_codes.should == 'product_codes'
server.private_dns_name.should == 'private_dns_name'
server.ramdisk_id.should == 'ramdisk_id'
end
end
describe "#addresses" do
2010-09-09 20:50:38 -04:00
it "should return a Fog::AWS::Compute::Addresses" do
subject.save
2010-09-09 20:50:38 -04:00
subject.addresses.should be_a(Fog::AWS::Compute::Addresses)
2010-01-08 14:29:07 -05:00
end
end
describe "#state" do
it "should remap values out of hash" do
2010-09-09 20:50:38 -04:00
server = Fog::AWS::Compute::Server.new({
2010-01-08 14:29:07 -05:00
'instanceState' => { 'name' => 'instance_state' },
})
server.state.should == 'instance_state'
end
end
describe "#key_pair" do
it "should have tests"
end
describe "#key_pair=" do
it "should have tests"
end
describe "#monitoring=" do
it "should remap values out of hash" do
2010-09-09 20:50:38 -04:00
server = Fog::AWS::Compute::Server.new({
2010-01-08 14:29:07 -05:00
'monitoring' => { 'state' => true }
})
server.monitoring.should == true
end
end
describe "#placement=" do
it "should remap values into availability_zone" do
2010-09-09 20:50:38 -04:00
server = Fog::AWS::Compute::Server.new({
2010-01-08 14:29:07 -05:00
'placement' => { 'availabilityZone' => 'availability_zone' }
})
server.availability_zone.should == 'availability_zone'
end
end
describe "#volumes" do
2010-09-09 20:50:38 -04:00
it "should return a Fog::AWS::Compute::Volumes" do
subject.save
2010-09-09 20:50:38 -04:00
subject.volumes.should be_a(Fog::AWS::Compute::Volumes)
2010-01-08 14:29:07 -05:00
end
end
end