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

fixes for/from specs/tests

This commit is contained in:
geemus 2010-09-09 17:50:38 -07:00
parent 136442206f
commit a963703309
142 changed files with 1338 additions and 1335 deletions

View file

@ -22,7 +22,7 @@ module Fog
model :volume model :volume
collection :volumes collection :volumes
require 'fog/aws/parsers/ec2/basic' require 'fog/aws/parsers/compute/basic'
request_path 'fog/aws/requests/compute' request_path 'fog/aws/requests/compute'
request :allocate_address request :allocate_address
@ -203,9 +203,9 @@ module Fog
if match = error.message.match(/<Code>(.*)<\/Code><Message>(.*)<\/Message>/) if match = error.message.match(/<Code>(.*)<\/Code><Message>(.*)<\/Message>/)
raise case match[1].split('.').last raise case match[1].split('.').last
when 'NotFound' when 'NotFound'
Fog::AWS::EC2::NotFound.slurp(error, match[2]) Fog::AWS::Compute::NotFound.slurp(error, match[2])
else else
Fog::AWS::EC2::Error.slurp(error, "#{match[1]} => #{match[2]}") Fog::AWS::Compute::Error.slurp(error, "#{match[1]} => #{match[2]}")
end end
else else
raise error raise error

View file

@ -7,8 +7,8 @@ module Fog
class Snapshots < Fog::Collection class Snapshots < Fog::Collection
attribute :owner, 'Owner' attribute :owner, :aliases => 'Owner'
attribute :restorable_by, 'RestorableBy' attribute :restorable_by, :aliases => 'RestorableBy'
attribute :snapshot_id attribute :snapshot_id
attribute :volume attribute :volume

View file

@ -45,9 +45,9 @@ module Fog
} }
response response
elsif !instance elsif !instance
raise Fog::AWS::EC2::NotFound.new("The instance ID '#{instance_id}' does not exist") raise Fog::AWS::Compute::NotFound.new("The instance ID '#{instance_id}' does not exist")
elsif !address elsif !address
raise Fog::AWS::EC2::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.") raise Fog::AWS::Compute::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.")
end end
end end

View file

@ -58,9 +58,9 @@ module Fog
}.merge!(data) }.merge!(data)
response response
elsif !instance elsif !instance
raise Fog::AWS::EC2::NotFound.new("The instance ID '#{instance_id}' does not exist.") raise Fog::AWS::Compute::NotFound.new("The instance ID '#{instance_id}' does not exist.")
elsif !volume elsif !volume
raise Fog::AWS::EC2::NotFound.new("The volume '#{volume_id}' does not exist.") raise Fog::AWS::Compute::NotFound.new("The volume '#{volume_id}' does not exist.")
end end
else else
message = 'MissingParameter => ' message = 'MissingParameter => '
@ -71,7 +71,7 @@ module Fog
else else
message << 'The request must contain the parameter device' message << 'The request must contain the parameter device'
end end
raise Fog::AWS::EC2::Error.new(message) raise Fog::AWS::Compute::Error.new(message)
end end
end end

View file

@ -76,7 +76,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::NotFound.new("The security group '#{options['GroupName']}' does not exist") raise Fog::AWS::Compute::NotFound.new("The security group '#{options['GroupName']}' does not exist")
end end
end end

View file

@ -44,7 +44,7 @@ module Fog
}.merge!(data) }.merge!(data)
response response
else else
raise Fog::AWS::EC2::Error.new("InvalidKeyPair.Duplicate => The keypair '#{key_name}' already exists.") raise Fog::AWS::Compute::Error.new("InvalidKeyPair.Duplicate => The keypair '#{key_name}' already exists.")
end end
end end

View file

@ -43,7 +43,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::Error.new("InvalidGroup.Duplicate => The security group '#{name}' already exists") raise Fog::AWS::Compute::Error.new("InvalidGroup.Duplicate => The security group '#{name}' already exists")
end end
end end

View file

@ -36,7 +36,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::NotFound.new("The security group '#{name}' does not exist") raise Fog::AWS::Compute::NotFound.new("The security group '#{name}' does not exist")
end end
end end
end end

View file

@ -36,7 +36,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::NotFound.new("The snapshot '#{snapshot_id}' does not exist.") raise Fog::AWS::Compute::NotFound.new("The snapshot '#{snapshot_id}' does not exist.")
end end
end end

View file

@ -31,7 +31,7 @@ module Fog
if volume = @data[:volumes][volume_id] if volume = @data[:volumes][volume_id]
if volume["attachmentSet"].any? if volume["attachmentSet"].any?
attach = volume["attachmentSet"].first attach = volume["attachmentSet"].first
raise Fog::AWS::EC2::Error.new("Client.VolumeInUse => Volume #{volume_id} is currently attached to #{attach["instanceId"]}") raise Fog::AWS::Compute::Error.new("Client.VolumeInUse => Volume #{volume_id} is currently attached to #{attach["instanceId"]}")
end end
@data[:deleted_at][volume_id] = Time.now @data[:deleted_at][volume_id] = Time.now
volume['status'] = 'deleting' volume['status'] = 'deleting'
@ -42,7 +42,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::NotFound.new("The volume '#{volume_id}' does not exist.") raise Fog::AWS::Compute::NotFound.new("The volume '#{volume_id}' does not exist.")
end end
end end

View file

@ -41,7 +41,7 @@ module Fog
if !instance_id if !instance_id
message << 'The request must contain the parameter image_id' message << 'The request must contain the parameter image_id'
end end
raise Fog::AWS::EC2::Error.new(message) raise Fog::AWS::Compute::Error.new(message)
end end
end end

View file

@ -46,7 +46,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::NotFound.new("Address #{public_ip.inspect} not found.") raise Fog::AWS::Compute::NotFound.new("Address #{public_ip.inspect} not found.")
end end
end end

View file

@ -54,7 +54,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::Error.new("InvalidParameterValue => Invalid availability zone: #{zone_name.inspect}") raise Fog::AWS::Compute::Error.new("InvalidParameterValue => Invalid availability zone: #{zone_name.inspect}")
end end
end end

View file

@ -119,7 +119,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::NotFound.new("The instance ID #{instance_id.inspect} does not exist") raise Fog::AWS::Compute::NotFound.new("The instance ID #{instance_id.inspect} does not exist")
end end
end end

View file

@ -48,7 +48,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::NotFound.new("The key pair #{key_name.inspect} does not exist") raise Fog::AWS::Compute::NotFound.new("The key pair #{key_name.inspect} does not exist")
end end
end end

View file

@ -51,7 +51,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::Error.new("InvalidParameterValue => Invalid region: #{region_name.inspect}") raise Fog::AWS::Compute::Error.new("InvalidParameterValue => Invalid region: #{region_name.inspect}")
end end
end end

View file

@ -56,7 +56,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::NotFound.new("The security group #{group_name.inspect} does not exist") raise Fog::AWS::Compute::NotFound.new("The security group #{group_name.inspect} does not exist")
end end
end end

View file

@ -70,7 +70,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::NotFound.new("The snapshot #{snapshot_id.inspect} does not exist.") raise Fog::AWS::Compute::NotFound.new("The snapshot #{snapshot_id.inspect} does not exist.")
end end
end end

View file

@ -76,7 +76,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::NotFound.new("The volume #{volume_id.inspect} does not exist.") raise Fog::AWS::Compute::NotFound.new("The volume #{volume_id.inspect} does not exist.")
end end
end end

View file

@ -48,7 +48,7 @@ module Fog
}.merge!(data) }.merge!(data)
response response
else else
raise Fog::AWS::EC2::NotFound.new("The volume '#{volume_id}' does not exist.") raise Fog::AWS::Compute::NotFound.new("The volume '#{volume_id}' does not exist.")
end end
end end

View file

@ -42,7 +42,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.") raise Fog::AWS::Compute::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.")
end end
end end

View file

@ -42,7 +42,7 @@ module Fog
} }
response response
else; else;
raise Fog::AWS::EC2::NotFound.new("The instance ID '#{instance_id}' does not exist") raise Fog::AWS::Compute::NotFound.new("The instance ID '#{instance_id}' does not exist")
end end
end end

View file

@ -40,7 +40,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::NotFound.new("The instance ID #{instance_id.inspect} does not exist") raise Fog::AWS::Compute::NotFound.new("The instance ID #{instance_id.inspect} does not exist")
end end
end end

View file

@ -79,7 +79,7 @@ module Fog
if name.empty? if name.empty?
message << 'The request must contain the parameter name' message << 'The request must contain the parameter name'
end end
raise Fog::AWS::EC2::Error.new(message) raise Fog::AWS::Compute::Error.new(message)
end end
end end

View file

@ -33,7 +33,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.") raise Fog::AWS::Compute::Error.new("AuthFailure => The address '#{public_ip}' does not belong to you.")
end end
end end

View file

@ -64,7 +64,7 @@ module Fog
} }
response response
else else
raise Fog::AWS::EC2::NotFound.new("The security group '#{options['GroupName']}' does not exist") raise Fog::AWS::Compute::NotFound.new("The security group '#{options['GroupName']}' does not exist")
end end
end end

View file

@ -84,7 +84,7 @@ module Fog
response response
else else
raise Fog::AWS::EC2::NotFound.new("The instance ID '#{instance_id}' does not exist") raise Fog::AWS::Compute::NotFound.new("The instance ID '#{instance_id}' does not exist")
end end
end end

View file

@ -31,7 +31,7 @@ module Fog
class Mock class Mock
def create_block(product_id, template_id, name, password) def create_block(product_id, template_id, options = {})
Fog::Mock.not_implemented Fog::Mock.not_implemented
end end

View file

@ -24,7 +24,7 @@ module Fog
class Mock class Mock
def get_slice(id) def get_block(block_id)
Fog::Mock.not_implemented Fog::Mock.not_implemented
end end

View file

@ -1,5 +1,5 @@
require 'fog/collection' require 'fog/collection'
require 'fog/rackspace/models/files/directory' require 'fog/rackspace/models/storage/directory'
module Fog module Fog
module Rackspace module Rackspace

View file

@ -10,7 +10,7 @@ module Fog
deprecate(:name, :key) deprecate(:name, :key)
deprecate(:name=, :key=) deprecate(:name=, :key=)
identity :key, ['name'] identity :key, :aliases => 'name'
attribute :bytes attribute :bytes
attribute :count attribute :count

View file

@ -33,7 +33,7 @@ module Fog
end end
response response
else else
raise Fog::Rackspace::Servers::NotFound raise Fog::Rackspace::Compute::NotFound
end end
end end

View file

@ -42,7 +42,7 @@ module Fog
response.body = { 'server' => server } response.body = { 'server' => server }
response response
else else
raise Fog::Rackspace::Servers::NotFound raise Fog::Rackspace::Compute::NotFound
end end
end end

View file

@ -33,7 +33,7 @@ module Fog
response.body = { 'addresses' => server['addresses'] } response.body = { 'addresses' => server['addresses'] }
response response
else else
raise Fog::Rackspace::Servers::NotFound raise Fog::Rackspace::Compute::NotFound
end end
end end

View file

@ -31,7 +31,7 @@ module Fog
response.body = { 'private' => server['addresses']['private'] } response.body = { 'private' => server['addresses']['private'] }
response response
else else
raise Fog::Rackspace::Servers::NotFound raise Fog::Rackspace::Compute::NotFound
end end
end end

View file

@ -31,7 +31,7 @@ module Fog
response.body = { 'public' => server['addresses']['public'] } response.body = { 'public' => server['addresses']['public'] }
response response
else else
raise Fog::Rackspace::Servers::NotFound raise Fog::Rackspace::Compute::NotFound
end end
end end

View file

@ -35,7 +35,7 @@ module Fog
response.status = 204 response.status = 204
response response
else else
raise Fog::Rackspace::Servers::NotFound raise Fog::Rackspace::Compute::NotFound
end end
end end

View file

@ -78,7 +78,7 @@ module Fog
rescue Excon::Errors::Error => error rescue Excon::Errors::Error => error
raise case error raise case error
when Excon::Errors::NotFound when Excon::Errors::NotFound
Fog::Slicehost::NotFound.slurp(error) Fog::Slicehost::Compute::NotFound.slurp(error)
else else
error error
end end

View file

@ -1,5 +1,5 @@
require 'fog/collection' require 'fog/collection'
require 'fog/slicehost/models/flavor' require 'fog/slicehost/models/compute/flavor'
module Fog module Fog
module Slicehost module Slicehost
@ -7,7 +7,7 @@ module Fog
class Flavors < Fog::Collection class Flavors < Fog::Collection
model Fog::Slicehost::Flavor model Fog::Slicehost::Compute::Flavor
def all def all
data = connection.get_flavors.body['flavors'] data = connection.get_flavors.body['flavors']
@ -15,7 +15,8 @@ module Fog
end end
def get(flavor_id) def get(flavor_id)
connection.get_flavor(flavor_id) data = connection.get_flavor(flavor_id).body
new(data)
rescue Excon::Errors::Forbidden rescue Excon::Errors::Forbidden
nil nil
end end

View file

@ -1,5 +1,5 @@
require 'fog/collection' require 'fog/collection'
require 'fog/slicehost/models/image' require 'fog/slicehost/models/compute/image'
module Fog module Fog
module Slicehost module Slicehost
@ -7,7 +7,7 @@ module Fog
class Images < Fog::Collection class Images < Fog::Collection
model Fog::Slicehost::Image model Fog::Slicehost::Compute::Image
def all def all
data = connection.get_images.body['images'] data = connection.get_images.body['images']

View file

@ -46,7 +46,7 @@ module Fog
def reboot(type = 'SOFT') def reboot(type = 'SOFT')
requires :id requires :id
connection.reboot_server(@id, type) connection.reboot_slice(@id, type)
true true
end end

View file

@ -1,5 +1,5 @@
require 'fog/collection' require 'fog/collection'
require 'fog/slicehost/models/server' require 'fog/slicehost/models/compute/server'
module Fog module Fog
module Slicehost module Slicehost
@ -7,7 +7,7 @@ module Fog
class Servers < Fog::Collection class Servers < Fog::Collection
model Fog::Slicehost::Server model Fog::Slicehost::Compute::Server
def all def all
data = connection.get_slices.body['slices'] data = connection.get_slices.body['slices']

View file

@ -34,7 +34,7 @@ module Fog
class Mock class Mock
def get_slice(id) def reboot_slice(id)
Fog::Mock.not_implemented Fog::Mock.not_implemented
end end

View file

@ -1,11 +1,11 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::EC2::Address' do describe 'Fog::AWS::Compute::Address' do
describe "#initialize" do describe "#initialize" do
it "should remap attributes from parser" do it "should remap attributes from parser" do
address = AWS[:ec2].addresses.new( address = AWS[:compute].addresses.new(
'instanceId' => 'i-00000000', 'instanceId' => 'i-00000000',
'publicIp' => '0.0.0.0' 'publicIp' => '0.0.0.0'
) )
@ -17,12 +17,12 @@ describe 'Fog::AWS::EC2::Address' do
describe "#addresses" do describe "#addresses" do
it "should return a Fog::AWS::EC2::Addresses" do it "should return a Fog::AWS::Compute::Addresses" do
AWS[:ec2].addresses.new.collection.should be_a(Fog::AWS::EC2::Addresses) AWS[:compute].addresses.new.collection.should be_a(Fog::AWS::Compute::Addresses)
end end
it "should be the addresses the address is related to" do it "should be the addresses the address is related to" do
addresses = AWS[:ec2].addresses addresses = AWS[:compute].addresses
addresses.new.collection.should == addresses addresses.new.collection.should == addresses
end end
@ -31,7 +31,7 @@ describe 'Fog::AWS::EC2::Address' do
describe "#destroy" do describe "#destroy" do
it "should return true if the address is deleted" do it "should return true if the address is deleted" do
address = AWS[:ec2].addresses.create address = AWS[:compute].addresses.create
address.destroy.should be_true address.destroy.should be_true
end end
@ -39,8 +39,8 @@ describe 'Fog::AWS::EC2::Address' do
describe "#server=" do describe "#server=" do
before(:each) do before(:each) do
@address = AWS[:ec2].addresses.new @address = AWS[:compute].addresses.new
@server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI) @server = AWS[:compute].servers.create(:image_id => GENTOO_AMI)
end end
after(:each) do after(:each) do
@ -59,7 +59,7 @@ describe 'Fog::AWS::EC2::Address' do
describe "#reload" do describe "#reload" do
before(:each) do before(:each) do
@address = AWS[:ec2].addresses.create @address = AWS[:compute].addresses.create
@reloaded = @address.reload @reloaded = @address.reload
end end
@ -67,8 +67,8 @@ describe 'Fog::AWS::EC2::Address' do
@address.destroy @address.destroy
end end
it "should return a Fog::AWS::EC2::Address" do it "should return a Fog::AWS::Compute::Address" do
@reloaded.should be_a(Fog::AWS::EC2::Address) @reloaded.should be_a(Fog::AWS::Compute::Address)
end end
it "should reset attributes to remote state" do it "should reset attributes to remote state" do
@ -80,7 +80,7 @@ describe 'Fog::AWS::EC2::Address' do
describe "#save" do describe "#save" do
before(:each) do before(:each) do
@address = AWS[:ec2].addresses.new @address = AWS[:compute].addresses.new
end end
it "should return true when it succeeds" do it "should return true when it succeeds" do

View file

@ -0,0 +1,70 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::Compute::Addresses' do
describe "#all" do
it "should return a Fog::AWS::Compute::Addresses" do
AWS[:compute].addresses.all.should be_a(Fog::AWS::Compute::Addresses)
end
it "should include persisted addresses" do
address = AWS[:compute].addresses.create
AWS[:compute].addresses.get(address.public_ip).should_not be_nil
address.destroy
end
end
describe "#create" do
before(:each) do
@address = AWS[:compute].addresses.create
end
after(:each) do
@address.destroy
end
it "should return a Fog::AWS::Compute::Address" do
@address.should be_a(Fog::AWS::Compute::Address)
end
it "should exist on ec2" do
AWS[:compute].addresses.get(@address.public_ip).should_not be_nil
end
end
describe "#get" do
it "should return a Fog::AWS::Compute::Address if a matching address exists" do
address = AWS[:compute].addresses.create
get = AWS[:compute].addresses.get(address.public_ip)
address.attributes.should == get.attributes
address.destroy
end
it "should return nil if no matching address exists" do
AWS[:compute].addresses.get('0.0.0.0').should be_nil
end
end
describe "#new" do
it "should return a Fog::AWS::Compute::Address" do
AWS[:compute].addresses.new.should be_a(Fog::AWS::Compute::Address)
end
end
describe "#reload" do
it "should return a Fog::AWS::Compute::Addresses" do
AWS[:compute].addresses.all.reload.should be_a(Fog::AWS::Compute::Addresses)
end
end
end

View file

@ -1,14 +1,14 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/../../../shared_examples/flavors_examples' require File.dirname(__FILE__) + '/../../../shared_examples/flavors_examples'
describe 'Fog::AWS::EC2::Flavors' do describe 'Fog::AWS::Compute::Flavors' do
it_should_behave_like "Flavors" it_should_behave_like "Flavors"
subject { @flavor = @flavors.all.first } subject { @flavor = @flavors.all.first }
before(:each) do before(:each) do
@flavors = AWS[:ec2].flavors @flavors = AWS[:compute].flavors
end end
end end

View file

@ -1,11 +1,11 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::EC2::KeyPair' do describe 'Fog::AWS::Compute::KeyPair' do
describe "#initialize" do describe "#initialize" do
it "should remap attributes from parser" do it "should remap attributes from parser" do
key_pair = AWS[:ec2].key_pairs.new( key_pair = AWS[:compute].key_pairs.new(
'keyFingerprint' => 'fingerprint', 'keyFingerprint' => 'fingerprint',
'keyMaterial' => 'material', 'keyMaterial' => 'material',
'keyName' => 'name' 'keyName' => 'name'
@ -19,12 +19,12 @@ describe 'Fog::AWS::EC2::KeyPair' do
describe "#collection" do describe "#collection" do
it "should return a Fog::AWS::EC2::KeyPairs" do it "should return a Fog::AWS::Compute::KeyPairs" do
AWS[:ec2].key_pairs.new.collection.should be_a(Fog::AWS::EC2::KeyPairs) AWS[:compute].key_pairs.new.collection.should be_a(Fog::AWS::Compute::KeyPairs)
end end
it "should be the key_pairs the keypair is related to" do it "should be the key_pairs the keypair is related to" do
key_pairs = AWS[:ec2].key_pairs key_pairs = AWS[:compute].key_pairs
key_pairs.new.collection.should == key_pairs key_pairs.new.collection.should == key_pairs
end end
@ -33,7 +33,7 @@ describe 'Fog::AWS::EC2::KeyPair' do
describe "#destroy" do describe "#destroy" do
it "should return true if the key_pair is deleted" do it "should return true if the key_pair is deleted" do
address = AWS[:ec2].key_pairs.create(:name => 'keyname') address = AWS[:compute].key_pairs.create(:name => 'keyname')
address.destroy.should be_true address.destroy.should be_true
end end
@ -42,7 +42,7 @@ describe 'Fog::AWS::EC2::KeyPair' do
describe "#reload" do describe "#reload" do
before(:each) do before(:each) do
@key_pair = AWS[:ec2].key_pairs.create(:name => 'keyname') @key_pair = AWS[:compute].key_pairs.create(:name => 'keyname')
@reloaded = @key_pair.reload @reloaded = @key_pair.reload
end end
@ -50,8 +50,8 @@ describe 'Fog::AWS::EC2::KeyPair' do
@key_pair.destroy @key_pair.destroy
end end
it "should return a Fog::AWS::EC2::KeyPair" do it "should return a Fog::AWS::Compute::KeyPair" do
@reloaded.should be_a(Fog::AWS::EC2::KeyPair) @reloaded.should be_a(Fog::AWS::Compute::KeyPair)
end end
it "should reset attributes to remote state" do it "should reset attributes to remote state" do
@ -63,7 +63,7 @@ describe 'Fog::AWS::EC2::KeyPair' do
describe "#save" do describe "#save" do
before(:each) do before(:each) do
@key_pair = AWS[:ec2].key_pairs.new(:name => 'keyname') @key_pair = AWS[:compute].key_pairs.new(:name => 'keyname')
end end
it "should return true when it succeeds" do it "should return true when it succeeds" do
@ -72,12 +72,12 @@ describe 'Fog::AWS::EC2::KeyPair' do
end end
it "should not exist in key_pairs before save" do it "should not exist in key_pairs before save" do
AWS[:ec2].key_pairs.get(@key_pair.name).should be_nil AWS[:compute].key_pairs.get(@key_pair.name).should be_nil
end end
it "should exist in buckets after save" do it "should exist in buckets after save" do
@key_pair.save @key_pair.save
AWS[:ec2].key_pairs.get(@key_pair.name).should_not be_nil AWS[:compute].key_pairs.get(@key_pair.name).should_not be_nil
@key_pair.destroy @key_pair.destroy
end end

View file

@ -0,0 +1,71 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::Compute::KeyPairs' do
describe "#all" do
it "should return a Fog::AWS::Compute::KeyPairs" do
AWS[:compute].key_pairs.all.should be_a(Fog::AWS::Compute::KeyPairs)
end
it "should include persisted key_pairs" do
key_pair = AWS[:compute].key_pairs.create(:name => 'keyname')
AWS[:compute].key_pairs.get(key_pair.name).should_not be_nil
key_pair.destroy
end
end
describe "#create" do
before(:each) do
@key_pair = AWS[:compute].key_pairs.create(:name => 'keyname')
end
after(:each) do
@key_pair.destroy
end
it "should return a Fog::AWS::Compute::KeyPair" do
@key_pair.should be_a(Fog::AWS::Compute::KeyPair)
end
it "should exist on ec2" do
AWS[:compute].key_pairs.get(@key_pair.name).should_not be_nil
end
end
describe "#get" do
it "should return a Fog::AWS::Compute::KeyPair if a matching key_pair exists" do
key_pair = AWS[:compute].key_pairs.create(:name => 'keyname')
get = AWS[:compute].key_pairs.get(key_pair.name)
key_pair.attributes[:fingerprint].should == get.attributes[:fingerprint]
key_pair.attributes[:name].should == get.attributes[:name]
key_pair.destroy
end
it "should return nil if no matching key_pair exists" do
AWS[:compute].key_pairs.get('notakeyname').should be_nil
end
end
describe "#new" do
it "should return a Fog::AWS::Compute::KeyPair" do
AWS[:compute].key_pairs.new(:name => 'keyname').should be_a(Fog::AWS::Compute::KeyPair)
end
end
describe "#reload" do
it "should return a Fog::AWS::Compute::KeyPairs" do
AWS[:compute].key_pairs.all.reload.should be_a(Fog::AWS::Compute::KeyPairs)
end
end
end

View file

@ -1,11 +1,11 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::EC2::SecurityGroup' do describe 'Fog::AWS::Compute::SecurityGroup' do
describe "#initialize" do describe "#initialize" do
it "should remap attributes from parser" do it "should remap attributes from parser" do
security_group = AWS[:ec2].security_groups.new( security_group = AWS[:compute].security_groups.new(
'groupDescription' => 'description', 'groupDescription' => 'description',
'groupName' => 'name', 'groupName' => 'name',
'ipPermissions' => 'permissions', 'ipPermissions' => 'permissions',
@ -21,12 +21,12 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
describe "#collection" do describe "#collection" do
it "should return a Fog::AWS::EC2::SecurityGroups" do it "should return a Fog::AWS::Compute::SecurityGroups" do
AWS[:ec2].security_groups.new.collection.should be_a(Fog::AWS::EC2::SecurityGroups) AWS[:compute].security_groups.new.collection.should be_a(Fog::AWS::Compute::SecurityGroups)
end end
it "should be the security_groups the keypair is related to" do it "should be the security_groups the keypair is related to" do
security_groups = AWS[:ec2].security_groups security_groups = AWS[:compute].security_groups
security_groups.new.collection.should == security_groups security_groups.new.collection.should == security_groups
end end
@ -35,7 +35,7 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
describe "#destroy" do describe "#destroy" do
it "should return true if the security_group is deleted" do it "should return true if the security_group is deleted" do
address = AWS[:ec2].security_groups.create(:description => 'groupdescription', :name => 'keyname') address = AWS[:compute].security_groups.create(:description => 'groupdescription', :name => 'keyname')
address.destroy.should be_true address.destroy.should be_true
end end
@ -44,7 +44,7 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
describe "#reload" do describe "#reload" do
before(:each) do before(:each) do
@security_group = AWS[:ec2].security_groups.create(:description => 'groupdescription', :name => 'keyname') @security_group = AWS[:compute].security_groups.create(:description => 'groupdescription', :name => 'keyname')
@reloaded = @security_group.reload @reloaded = @security_group.reload
end end
@ -52,8 +52,8 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
@security_group.destroy @security_group.destroy
end end
it "should return a Fog::AWS::EC2::SecurityGroup" do it "should return a Fog::AWS::Compute::SecurityGroup" do
@reloaded.should be_a(Fog::AWS::EC2::SecurityGroup) @reloaded.should be_a(Fog::AWS::Compute::SecurityGroup)
end end
it "should reset attributes to remote state" do it "should reset attributes to remote state" do
@ -65,7 +65,7 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
describe "#save" do describe "#save" do
before(:each) do before(:each) do
@security_group = AWS[:ec2].security_groups.new(:description => 'groupdescription', :name => 'keyname') @security_group = AWS[:compute].security_groups.new(:description => 'groupdescription', :name => 'keyname')
end end
it "should return true when it succeeds" do it "should return true when it succeeds" do
@ -74,12 +74,12 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
end end
it "should not exist in security_groups before save" do it "should not exist in security_groups before save" do
AWS[:ec2].security_groups.get(@security_group.name).should be_nil AWS[:compute].security_groups.get(@security_group.name).should be_nil
end end
it "should exist in buckets after save" do it "should exist in buckets after save" do
@security_group.save @security_group.save
AWS[:ec2].security_groups.get(@security_group.name).should_not be_nil AWS[:compute].security_groups.get(@security_group.name).should_not be_nil
@security_group.destroy @security_group.destroy
end end

View file

@ -0,0 +1,71 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::Compute::SecurityGroups' do
describe "#all" do
it "should return a Fog::AWS::Compute::SecurityGroups" do
AWS[:compute].security_groups.all.should be_a(Fog::AWS::Compute::SecurityGroups)
end
it "should include persisted security_groups" do
security_group = AWS[:compute].security_groups.create(:description => 'groupdescription', :name => 'keyname')
AWS[:compute].security_groups.get(security_group.name).should_not be_nil
security_group.destroy
end
end
describe "#create" do
before(:each) do
@security_group = AWS[:compute].security_groups.create(:description => 'groupdescription', :name => 'keyname')
end
after(:each) do
@security_group.destroy
end
it "should return a Fog::AWS::Compute::SecurityGroup" do
@security_group.should be_a(Fog::AWS::Compute::SecurityGroup)
end
it "should exist on ec2" do
AWS[:compute].security_groups.get(@security_group.name).should_not be_nil
end
end
describe "#get" do
it "should return a Fog::AWS::Compute::SecurityGroup if a matching security_group exists" do
security_group = AWS[:compute].security_groups.create(:description => 'groupdescription', :name => 'keyname')
get = AWS[:compute].security_groups.get(security_group.name)
security_group.attributes[:fingerprint].should == get.attributes[:fingerprint]
security_group.attributes[:name].should == get.attributes[:name]
security_group.destroy
end
it "should return nil if no matching security_group exists" do
AWS[:compute].security_groups.get('notasecuritygroupname').should be_nil
end
end
describe "#new" do
it "should return a Fog::AWS::Compute::SecurityGroup" do
AWS[:compute].security_groups.new(:description => 'groupdescription', :name => 'keyname').should be_a(Fog::AWS::Compute::SecurityGroup)
end
end
describe "#reload" do
it "should return a Fog::AWS::Compute::SecurityGroups" do
AWS[:compute].security_groups.all.reload.should be_a(Fog::AWS::Compute::SecurityGroups)
end
end
end

View file

@ -1,14 +1,14 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/../../../shared_examples/server_examples' require File.dirname(__FILE__) + '/../../../shared_examples/server_examples'
describe 'Fog::AWS::EC2::Server' do describe 'Fog::AWS::Compute::Server' do
it_should_behave_like "Server" it_should_behave_like "Server"
subject { @server = @servers.new(:image_id => GENTOO_AMI) } subject { @server = @servers.new(:image_id => GENTOO_AMI) }
before(:each) do before(:each) do
@servers = AWS[:ec2].servers @servers = AWS[:compute].servers
end end
after(:each) do after(:each) do
@ -50,16 +50,16 @@ describe 'Fog::AWS::EC2::Server' do
describe "#addresses" do describe "#addresses" do
it "should return a Fog::AWS::EC2::Addresses" do it "should return a Fog::AWS::Compute::Addresses" do
subject.save subject.save
subject.addresses.should be_a(Fog::AWS::EC2::Addresses) subject.addresses.should be_a(Fog::AWS::Compute::Addresses)
end end
end end
describe "#state" do describe "#state" do
it "should remap values out of hash" do it "should remap values out of hash" do
server = Fog::AWS::EC2::Server.new({ server = Fog::AWS::Compute::Server.new({
'instanceState' => { 'name' => 'instance_state' }, 'instanceState' => { 'name' => 'instance_state' },
}) })
server.state.should == 'instance_state' server.state.should == 'instance_state'
@ -76,7 +76,7 @@ describe 'Fog::AWS::EC2::Server' do
describe "#monitoring=" do describe "#monitoring=" do
it "should remap values out of hash" do it "should remap values out of hash" do
server = Fog::AWS::EC2::Server.new({ server = Fog::AWS::Compute::Server.new({
'monitoring' => { 'state' => true } 'monitoring' => { 'state' => true }
}) })
server.monitoring.should == true server.monitoring.should == true
@ -86,7 +86,7 @@ describe 'Fog::AWS::EC2::Server' do
describe "#placement=" do describe "#placement=" do
it "should remap values into availability_zone" do it "should remap values into availability_zone" do
server = Fog::AWS::EC2::Server.new({ server = Fog::AWS::Compute::Server.new({
'placement' => { 'availabilityZone' => 'availability_zone' } 'placement' => { 'availabilityZone' => 'availability_zone' }
}) })
server.availability_zone.should == 'availability_zone' server.availability_zone.should == 'availability_zone'
@ -96,9 +96,9 @@ describe 'Fog::AWS::EC2::Server' do
describe "#volumes" do describe "#volumes" do
it "should return a Fog::AWS::EC2::Volumes" do it "should return a Fog::AWS::Compute::Volumes" do
subject.save subject.save
subject.volumes.should be_a(Fog::AWS::EC2::Volumes) subject.volumes.should be_a(Fog::AWS::Compute::Volumes)
end end
end end

View file

@ -1,14 +1,14 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/../../../shared_examples/servers_examples' require File.dirname(__FILE__) + '/../../../shared_examples/servers_examples'
describe 'Fog::AWS::EC2::Servers' do describe 'Fog::AWS::Compute::Servers' do
it_should_behave_like "Servers" it_should_behave_like "Servers"
subject { @server = @servers.new(:image_id => GENTOO_AMI) } subject { @server = @servers.new(:image_id => GENTOO_AMI) }
before(:each) do before(:each) do
@servers = AWS[:ec2].servers @servers = AWS[:compute].servers
end end
after(:each) do after(:each) do

View file

@ -1,9 +1,9 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::EC2::Snapshot' do describe 'Fog::AWS::Compute::Snapshot' do
before(:all) do before(:all) do
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1') @volume = AWS[:compute].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
@volume.wait_for { ready? } @volume.wait_for { ready? }
end end
@ -21,7 +21,7 @@ describe 'Fog::AWS::EC2::Snapshot' do
describe "#initialize" do describe "#initialize" do
it "should remap attributes from parser" do it "should remap attributes from parser" do
snapshot = AWS[:ec2].snapshots.new( snapshot = AWS[:compute].snapshots.new(
'snapshotId' => 'snap-00000000', 'snapshotId' => 'snap-00000000',
'startTime' => 'now', 'startTime' => 'now',
'volumeId' => 'vol-00000000', 'volumeId' => 'vol-00000000',
@ -54,7 +54,7 @@ describe 'Fog::AWS::EC2::Snapshot' do
end end
it "should match the original" do it "should match the original" do
@reloaded.should be_a(Fog::AWS::EC2::Snapshot) @reloaded.should be_a(Fog::AWS::Compute::Snapshot)
@reloaded.attributes.should == @snapshot.attributes @reloaded.attributes.should == @snapshot.attributes
end end
@ -64,14 +64,14 @@ describe 'Fog::AWS::EC2::Snapshot' do
it "should persist the snapshot" do it "should persist the snapshot" do
@snapshot = @volume.snapshots.new @snapshot = @volume.snapshots.new
AWS[:ec2].snapshots.get(@snapshot.id).should be_nil AWS[:compute].snapshots.get(@snapshot.id).should be_nil
@snapshot.save.should be_true @snapshot.save.should be_true
AWS[:ec2].snapshots.get(@snapshot.id).should_not be_nil AWS[:compute].snapshots.get(@snapshot.id).should_not be_nil
end end
it "should allow a description" do it "should allow a description" do
@snapshot = @volume.snapshots.create(:description => 'taken for safety') @snapshot = @volume.snapshots.create(:description => 'taken for safety')
AWS[:ec2].snapshots.get(@snapshot.id).description.should == 'taken for safety' AWS[:compute].snapshots.get(@snapshot.id).description.should == 'taken for safety'
end end
end end

View file

@ -1,9 +1,9 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::EC2::Snapshots' do describe 'Fog::AWS::Compute::Snapshots' do
before(:all) do before(:all) do
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1') @volume = AWS[:compute].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
@volume.wait_for { ready? } @volume.wait_for { ready? }
end end
@ -25,11 +25,11 @@ describe 'Fog::AWS::EC2::Snapshots' do
end end
it "should include persisted snapshots" do it "should include persisted snapshots" do
AWS[:ec2].snapshots.all.map {|snapshot| snapshot.id}.should include(@snapshot.id) AWS[:compute].snapshots.all.map {|snapshot| snapshot.id}.should include(@snapshot.id)
end end
it "should limit snapshots by volume if present" do it "should limit snapshots by volume if present" do
@other_volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1') @other_volume = AWS[:compute].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
@volume.snapshots.map {|snapshot| snapshot.id}.should include(@snapshot.identity) @volume.snapshots.map {|snapshot| snapshot.id}.should include(@snapshot.identity)
@other_volume.snapshots.map {|snapshot| snapshot.id}.should_not include(@snapshot.identity) @other_volume.snapshots.map {|snapshot| snapshot.id}.should_not include(@snapshot.identity)
@ -46,38 +46,38 @@ describe 'Fog::AWS::EC2::Snapshots' do
end end
it "should exist on ec2" do it "should exist on ec2" do
AWS[:ec2].snapshots.get(@snapshot.id).should_not be_nil AWS[:compute].snapshots.get(@snapshot.id).should_not be_nil
end end
end end
describe "#get" do describe "#get" do
it "should return a Fog::AWS::EC2::Snapshot if a matching snapshot exists" do it "should return a Fog::AWS::Compute::Snapshot if a matching snapshot exists" do
@snapshot = @volume.snapshots.create @snapshot = @volume.snapshots.create
@snapshot.wait_for { ready? } @snapshot.wait_for { ready? }
get = AWS[:ec2].snapshots.get(@snapshot.id) get = AWS[:compute].snapshots.get(@snapshot.id)
@snapshot.attributes.should == get.attributes @snapshot.attributes.should == get.attributes
end end
it "should return nil if no matching address exists" do it "should return nil if no matching address exists" do
AWS[:ec2].snapshots.get('snap-00000000').should be_nil AWS[:compute].snapshots.get('snap-00000000').should be_nil
end end
end end
describe "#new" do describe "#new" do
it "should return a Fog::AWS::EC2::Snapshot" do it "should return a Fog::AWS::Compute::Snapshot" do
AWS[:ec2].snapshots.new.should be_a(Fog::AWS::EC2::Snapshot) AWS[:compute].snapshots.new.should be_a(Fog::AWS::Compute::Snapshot)
end end
end end
describe "#reload" do describe "#reload" do
it "should return a Fog::AWS::EC2::Snapshots" do it "should return a Fog::AWS::Compute::Snapshots" do
AWS[:ec2].snapshots.all.reload.should be_a(Fog::AWS::EC2::Snapshots) AWS[:compute].snapshots.all.reload.should be_a(Fog::AWS::Compute::Snapshots)
end end
end end

View file

@ -1,11 +1,11 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::EC2::Volume' do describe 'Fog::AWS::Compute::Volume' do
describe "#initialize" do describe "#initialize" do
it "should remap attributes from parser" do it "should remap attributes from parser" do
volume = AWS[:ec2].volumes.new( volume = AWS[:compute].volumes.new(
'attachTime' => 'now', 'attachTime' => 'now',
'availabilityZone' => 'us-east-1a', 'availabilityZone' => 'us-east-1a',
'createTime' => 'recently', 'createTime' => 'recently',
@ -25,12 +25,12 @@ describe 'Fog::AWS::EC2::Volume' do
describe "#collection" do describe "#collection" do
it "should return a Fog::AWS::EC2::Volumes" do it "should return a Fog::AWS::Compute::Volumes" do
AWS[:ec2].volumes.new.collection.should be_a(Fog::AWS::EC2::Volumes) AWS[:compute].volumes.new.collection.should be_a(Fog::AWS::Compute::Volumes)
end end
it "should be the volumes the volume is related to" do it "should be the volumes the volume is related to" do
volumes = AWS[:ec2].volumes volumes = AWS[:compute].volumes
volumes.new.collection.should == volumes volumes.new.collection.should == volumes
end end
@ -39,14 +39,14 @@ describe 'Fog::AWS::EC2::Volume' do
describe "#destroy" do describe "#destroy" do
it "should return true if the volume is deleted" do it "should return true if the volume is deleted" do
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1') volume = AWS[:compute].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
volume.destroy.should be_true volume.destroy.should be_true
end end
it 'should fail if the volume is attached to an instance' do it 'should fail if the volume is attached to an instance' do
server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI) server = AWS[:compute].servers.create(:image_id => GENTOO_AMI)
server.wait_for { ready? } server.wait_for { ready? }
volume = AWS[:ec2].volumes.create(:availability_zone => server.availability_zone, :size => 1, :device => '/dev/sdz1') volume = AWS[:compute].volumes.create(:availability_zone => server.availability_zone, :size => 1, :device => '/dev/sdz1')
volume.server = server volume.server = server
lambda { volume.destroy }.should raise_error lambda { volume.destroy }.should raise_error
end end
@ -55,7 +55,7 @@ describe 'Fog::AWS::EC2::Volume' do
describe "#server=" do describe "#server=" do
before(:all) do before(:all) do
@server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI) @server = AWS[:compute].servers.create(:image_id => GENTOO_AMI)
@server.wait_for { ready? } @server.wait_for { ready? }
end end
@ -64,7 +64,7 @@ describe 'Fog::AWS::EC2::Volume' do
end end
before(:each) do before(:each) do
@volume = AWS[:ec2].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1') @volume = AWS[:compute].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
end end
after(:each) do after(:each) do
@ -108,7 +108,7 @@ describe 'Fog::AWS::EC2::Volume' do
describe "#reload" do describe "#reload" do
before(:each) do before(:each) do
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1') @volume = AWS[:compute].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
@reloaded = @volume.reload @reloaded = @volume.reload
end end
@ -116,8 +116,8 @@ describe 'Fog::AWS::EC2::Volume' do
@volume.destroy @volume.destroy
end end
it "should return a Fog::AWS::EC2::Volume" do it "should return a Fog::AWS::Compute::Volume" do
@reloaded.should be_a(Fog::AWS::EC2::Volume) @reloaded.should be_a(Fog::AWS::Compute::Volume)
end end
it "should reset attributes to remote state" do it "should reset attributes to remote state" do
@ -129,7 +129,7 @@ describe 'Fog::AWS::EC2::Volume' do
describe "#save" do describe "#save" do
before(:each) do before(:each) do
@volume = AWS[:ec2].volumes.new(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1') @volume = AWS[:compute].volumes.new(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
end end
it "should return true when it succeeds" do it "should return true when it succeeds" do
@ -138,12 +138,12 @@ describe 'Fog::AWS::EC2::Volume' do
end end
it "should not exist in volumes before save" do it "should not exist in volumes before save" do
AWS[:ec2].volumes.get(@volume.id).should be_nil AWS[:compute].volumes.get(@volume.id).should be_nil
end end
it "should exist in buckets after save" do it "should exist in buckets after save" do
@volume.save @volume.save
AWS[:ec2].volumes.get(@volume.id).should_not be_nil AWS[:compute].volumes.get(@volume.id).should_not be_nil
@volume.destroy @volume.destroy
end end

View file

@ -0,0 +1,71 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::Compute::Volumes' do
describe "#all" do
it "should return a Fog::AWS::Compute::Volumes" do
AWS[:compute].volumes.all.should be_a(Fog::AWS::Compute::Volumes)
end
it "should include persisted volumes" do
volume = AWS[:compute].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
AWS[:compute].volumes.get(volume.id).should_not be_nil
volume.destroy
end
end
describe "#create" do
before(:each) do
@volume = AWS[:compute].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
end
after(:each) do
@volume.destroy
end
it "should return a Fog::AWS::Compute::Volume" do
@volume.should be_a(Fog::AWS::Compute::Volume)
end
it "should exist on ec2" do
AWS[:compute].volumes.get(@volume.id).should_not be_nil
end
end
describe "#get" do
it "should return a Fog::AWS::Compute::Volume if a matching volume exists" do
volume = AWS[:compute].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
volume.wait_for { ready? }
get = AWS[:compute].volumes.get(volume.id)
volume.attributes.should == get.attributes
volume.destroy
end
it "should return nil if no matching address exists" do
AWS[:compute].volumes.get('vol-00000000').should be_nil
end
end
describe "#new" do
it "should return a Fog::AWS::Compute::Volume" do
AWS[:compute].volumes.new.should be_a(Fog::AWS::Compute::Volume)
end
end
describe "#reload" do
it "should return a Fog::AWS::Compute::Volumes" do
AWS[:compute].volumes.all.reload.should be_a(Fog::AWS::Compute::Volumes)
end
end
end

View file

@ -1,70 +0,0 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::EC2::Addresses' do
describe "#all" do
it "should return a Fog::AWS::EC2::Addresses" do
AWS[:ec2].addresses.all.should be_a(Fog::AWS::EC2::Addresses)
end
it "should include persisted addresses" do
address = AWS[:ec2].addresses.create
AWS[:ec2].addresses.get(address.public_ip).should_not be_nil
address.destroy
end
end
describe "#create" do
before(:each) do
@address = AWS[:ec2].addresses.create
end
after(:each) do
@address.destroy
end
it "should return a Fog::AWS::EC2::Address" do
@address.should be_a(Fog::AWS::EC2::Address)
end
it "should exist on ec2" do
AWS[:ec2].addresses.get(@address.public_ip).should_not be_nil
end
end
describe "#get" do
it "should return a Fog::AWS::EC2::Address if a matching address exists" do
address = AWS[:ec2].addresses.create
get = AWS[:ec2].addresses.get(address.public_ip)
address.attributes.should == get.attributes
address.destroy
end
it "should return nil if no matching address exists" do
AWS[:ec2].addresses.get('0.0.0.0').should be_nil
end
end
describe "#new" do
it "should return a Fog::AWS::EC2::Address" do
AWS[:ec2].addresses.new.should be_a(Fog::AWS::EC2::Address)
end
end
describe "#reload" do
it "should return a Fog::AWS::EC2::Addresses" do
AWS[:ec2].addresses.all.reload.should be_a(Fog::AWS::EC2::Addresses)
end
end
end

View file

@ -1,71 +0,0 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::EC2::KeyPairs' do
describe "#all" do
it "should return a Fog::AWS::EC2::KeyPairs" do
AWS[:ec2].key_pairs.all.should be_a(Fog::AWS::EC2::KeyPairs)
end
it "should include persisted key_pairs" do
key_pair = AWS[:ec2].key_pairs.create(:name => 'keyname')
AWS[:ec2].key_pairs.get(key_pair.name).should_not be_nil
key_pair.destroy
end
end
describe "#create" do
before(:each) do
@key_pair = AWS[:ec2].key_pairs.create(:name => 'keyname')
end
after(:each) do
@key_pair.destroy
end
it "should return a Fog::AWS::EC2::KeyPair" do
@key_pair.should be_a(Fog::AWS::EC2::KeyPair)
end
it "should exist on ec2" do
AWS[:ec2].key_pairs.get(@key_pair.name).should_not be_nil
end
end
describe "#get" do
it "should return a Fog::AWS::EC2::KeyPair if a matching key_pair exists" do
key_pair = AWS[:ec2].key_pairs.create(:name => 'keyname')
get = AWS[:ec2].key_pairs.get(key_pair.name)
key_pair.attributes[:fingerprint].should == get.attributes[:fingerprint]
key_pair.attributes[:name].should == get.attributes[:name]
key_pair.destroy
end
it "should return nil if no matching key_pair exists" do
AWS[:ec2].key_pairs.get('notakeyname').should be_nil
end
end
describe "#new" do
it "should return a Fog::AWS::EC2::KeyPair" do
AWS[:ec2].key_pairs.new(:name => 'keyname').should be_a(Fog::AWS::EC2::KeyPair)
end
end
describe "#reload" do
it "should return a Fog::AWS::EC2::KeyPairs" do
AWS[:ec2].key_pairs.all.reload.should be_a(Fog::AWS::EC2::KeyPairs)
end
end
end

View file

@ -1,71 +0,0 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::EC2::SecurityGroups' do
describe "#all" do
it "should return a Fog::AWS::EC2::SecurityGroups" do
AWS[:ec2].security_groups.all.should be_a(Fog::AWS::EC2::SecurityGroups)
end
it "should include persisted security_groups" do
security_group = AWS[:ec2].security_groups.create(:description => 'groupdescription', :name => 'keyname')
AWS[:ec2].security_groups.get(security_group.name).should_not be_nil
security_group.destroy
end
end
describe "#create" do
before(:each) do
@security_group = AWS[:ec2].security_groups.create(:description => 'groupdescription', :name => 'keyname')
end
after(:each) do
@security_group.destroy
end
it "should return a Fog::AWS::EC2::SecurityGroup" do
@security_group.should be_a(Fog::AWS::EC2::SecurityGroup)
end
it "should exist on ec2" do
AWS[:ec2].security_groups.get(@security_group.name).should_not be_nil
end
end
describe "#get" do
it "should return a Fog::AWS::EC2::SecurityGroup if a matching security_group exists" do
security_group = AWS[:ec2].security_groups.create(:description => 'groupdescription', :name => 'keyname')
get = AWS[:ec2].security_groups.get(security_group.name)
security_group.attributes[:fingerprint].should == get.attributes[:fingerprint]
security_group.attributes[:name].should == get.attributes[:name]
security_group.destroy
end
it "should return nil if no matching security_group exists" do
AWS[:ec2].security_groups.get('notasecuritygroupname').should be_nil
end
end
describe "#new" do
it "should return a Fog::AWS::EC2::SecurityGroup" do
AWS[:ec2].security_groups.new(:description => 'groupdescription', :name => 'keyname').should be_a(Fog::AWS::EC2::SecurityGroup)
end
end
describe "#reload" do
it "should return a Fog::AWS::EC2::SecurityGroups" do
AWS[:ec2].security_groups.all.reload.should be_a(Fog::AWS::EC2::SecurityGroups)
end
end
end

View file

@ -1,71 +0,0 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::EC2::Volumes' do
describe "#all" do
it "should return a Fog::AWS::EC2::Volumes" do
AWS[:ec2].volumes.all.should be_a(Fog::AWS::EC2::Volumes)
end
it "should include persisted volumes" do
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
AWS[:ec2].volumes.get(volume.id).should_not be_nil
volume.destroy
end
end
describe "#create" do
before(:each) do
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
end
after(:each) do
@volume.destroy
end
it "should return a Fog::AWS::EC2::Volume" do
@volume.should be_a(Fog::AWS::EC2::Volume)
end
it "should exist on ec2" do
AWS[:ec2].volumes.get(@volume.id).should_not be_nil
end
end
describe "#get" do
it "should return a Fog::AWS::EC2::Volume if a matching volume exists" do
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
volume.wait_for { ready? }
get = AWS[:ec2].volumes.get(volume.id)
volume.attributes.should == get.attributes
volume.destroy
end
it "should return nil if no matching address exists" do
AWS[:ec2].volumes.get('vol-00000000').should be_nil
end
end
describe "#new" do
it "should return a Fog::AWS::EC2::Volume" do
AWS[:ec2].volumes.new.should be_a(Fog::AWS::EC2::Volume)
end
end
describe "#reload" do
it "should return a Fog::AWS::EC2::Volumes" do
AWS[:ec2].volumes.all.reload.should be_a(Fog::AWS::EC2::Volumes)
end
end
end

View file

@ -1,49 +0,0 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::S3::Directories' do
describe "#all" do
it "should include persisted directories" do
@directory = AWS[:s3].directories.create(:key => 'fogdirectorykey')
AWS[:s3].directories.all.map {|directory| @directory.key}.should include('fogdirectorykey')
@directory.destroy
end
end
describe "#create" do
it "should exist on s3" do
directory = AWS[:s3].directories.create(:key => 'fogdirectorykey')
AWS[:s3].directories.get(directory.key).should_not be_nil
directory.destroy
end
end
describe "#get" do
it "should return a Fog::AWS::S3::Directory if a matching directory exists" do
directory = AWS[:s3].directories.create(:key => 'fogdirectorykey')
get = AWS[:s3].directories.get('fogdirectorykey')
directory.attributes.should == get.attributes
directory.destroy
end
it "should return nil if no matching directory exists" do
AWS[:s3].directories.get('fognotadirectory').should be_nil
end
end
describe "#reload" do
it "should reload data" do
directories = AWS[:s3].directories
directories.should == directories.reload
end
end
end

View file

@ -0,0 +1,49 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::Storage::Directories' do
describe "#all" do
it "should include persisted directories" do
@directory = AWS[:storage].directories.create(:key => 'fogdirectorykey')
AWS[:storage].directories.all.map {|directory| @directory.key}.should include('fogdirectorykey')
@directory.destroy
end
end
describe "#create" do
it "should exist on s3" do
directory = AWS[:storage].directories.create(:key => 'fogdirectorykey')
AWS[:storage].directories.get(directory.key).should_not be_nil
directory.destroy
end
end
describe "#get" do
it "should return a Fog::AWS::Storage::Directory if a matching directory exists" do
directory = AWS[:storage].directories.create(:key => 'fogdirectorykey')
get = AWS[:storage].directories.get('fogdirectorykey')
directory.attributes.should == get.attributes
directory.destroy
end
it "should return nil if no matching directory exists" do
AWS[:storage].directories.get('fognotadirectory').should be_nil
end
end
describe "#reload" do
it "should reload data" do
directories = AWS[:storage].directories
directories.should == directories.reload
end
end
end

View file

@ -1,12 +1,12 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::S3::Directory' do describe 'Fog::AWS::Storage::Directory' do
describe "#initialize" do describe "#initialize" do
it "should remap attributes from parser" do it "should remap attributes from parser" do
now = Time.now now = Time.now
directory = Fog::AWS::S3::Directory.new( directory = Fog::AWS::Storage::Directory.new(
'CreationDate' => now, 'CreationDate' => now,
'Name' => 'directorykey' 'Name' => 'directorykey'
) )
@ -19,7 +19,7 @@ describe 'Fog::AWS::S3::Directory' do
describe "#collection" do describe "#collection" do
it "should be the directories the directory is related to" do it "should be the directories the directory is related to" do
directories = AWS[:s3].directories directories = AWS[:storage].directories
directories.new.collection.should == directories directories.new.collection.should == directories
end end
@ -28,12 +28,12 @@ describe 'Fog::AWS::S3::Directory' do
describe "#destroy" do describe "#destroy" do
it "should return true if the directory is deleted" do it "should return true if the directory is deleted" do
directory = AWS[:s3].directories.create(:key => 'fogmodeldirectory') directory = AWS[:storage].directories.create(:key => 'fogmodeldirectory')
directory.destroy.should be_true directory.destroy.should be_true
end end
it "should return false if the directory does not exist" do it "should return false if the directory does not exist" do
directory = AWS[:s3].directories.new(:key => 'fogmodeldirectory') directory = AWS[:storage].directories.new(:key => 'fogmodeldirectory')
directory.destroy.should be_false directory.destroy.should be_false
end end
@ -42,9 +42,9 @@ describe 'Fog::AWS::S3::Directory' do
describe "#location" do describe "#location" do
it "should return the location constraint" do it "should return the location constraint" do
directory = AWS[:s3].directories.create(:key => 'fogmodeleudirectory', :location => 'EU') directory = AWS[:storage].directories.create(:key => 'fogmodeleudirectory', :location => 'EU')
directory.location.should == 'EU' directory.location.should == 'EU'
AWS[:eu_s3].directories.get('fogmodeleudirectory').destroy AWS[:eu_storage].directories.get('fogmodeleudirectory').destroy
end end
end end
@ -52,7 +52,7 @@ describe 'Fog::AWS::S3::Directory' do
describe "#payer" do describe "#payer" do
it "should return the request payment value" do it "should return the request payment value" do
directory = AWS[:s3].directories.create(:key => 'fogmodeldirectory') directory = AWS[:storage].directories.create(:key => 'fogmodeldirectory')
directory.payer.should == 'BucketOwner' directory.payer.should == 'BucketOwner'
directory.destroy.should be_true directory.destroy.should be_true
end end
@ -62,7 +62,7 @@ describe 'Fog::AWS::S3::Directory' do
describe "#payer=" do describe "#payer=" do
it "should set the request payment value" do it "should set the request payment value" do
directory = AWS[:s3].directories.create(:key => 'fogmodeldirectory') directory = AWS[:storage].directories.create(:key => 'fogmodeldirectory')
(directory.payer = 'Requester').should == 'Requester' (directory.payer = 'Requester').should == 'Requester'
directory.destroy.should directory.destroy.should
end end
@ -72,7 +72,7 @@ describe 'Fog::AWS::S3::Directory' do
describe "#reload" do describe "#reload" do
before(:each) do before(:each) do
@directory = AWS[:s3].directories.create(:key => 'fogmodeldirectory') @directory = AWS[:storage].directories.create(:key => 'fogmodeldirectory')
@reloaded = @directory.reload @reloaded = @directory.reload
end end
@ -89,11 +89,11 @@ describe 'Fog::AWS::S3::Directory' do
describe "#save" do describe "#save" do
before(:each) do before(:each) do
@directory = AWS[:s3].directories.new(:key => 'fogmodeldirectory') @directory = AWS[:storage].directories.new(:key => 'fogmodeldirectory')
end end
it "should not exist in directories before save" do it "should not exist in directories before save" do
AWS[:s3].directories.all.map {|directory| directory.key}.include?(@directory.key).should be_false AWS[:storage].directories.all.map {|directory| directory.key}.include?(@directory.key).should be_false
end end
it "should return true when it succeeds" do it "should return true when it succeeds" do
@ -103,7 +103,7 @@ describe 'Fog::AWS::S3::Directory' do
it "should exist in directories after save" do it "should exist in directories after save" do
@directory.save @directory.save
AWS[:s3].directories.all.map {|directory| directory.key}.include?(@directory.key).should be_true AWS[:storage].directories.all.map {|directory| directory.key}.include?(@directory.key).should be_true
@directory.destroy @directory.destroy
end end

View file

@ -1,9 +1,9 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::S3::File' do describe 'Fog::AWS::Storage::File' do
before(:each) do before(:each) do
@directory = AWS[:s3].directories.create(:key => 'fogdirectoryname') @directory = AWS[:storage].directories.create(:key => 'fogdirectoryname')
end end
after(:each) do after(:each) do
@ -14,7 +14,7 @@ describe 'Fog::AWS::S3::File' do
it "should remap attributes from parser" do it "should remap attributes from parser" do
now = Time.now now = Time.now
directory = Fog::AWS::S3::File.new( directory = Fog::AWS::Storage::File.new(
'Content-Length' => 10, 'Content-Length' => 10,
'Content-Type' => 'contenttype', 'Content-Type' => 'contenttype',
'Etag' => 'etag', 'Etag' => 'etag',
@ -31,7 +31,7 @@ describe 'Fog::AWS::S3::File' do
directory.size.should == 10 directory.size.should == 10
directory.storage_class.should == 'storageclass' directory.storage_class.should == 'storageclass'
directory = Fog::AWS::S3::File.new( directory = Fog::AWS::Storage::File.new(
'ETag' => 'etag', 'ETag' => 'etag',
'LastModified' => now 'LastModified' => now
) )
@ -52,8 +52,8 @@ describe 'Fog::AWS::S3::File' do
describe "#copy" do describe "#copy" do
it "should return a Fog::AWS::S3::File with matching attributes" do it "should return a Fog::AWS::Storage::File with matching attributes" do
other_directory = AWS[:s3].directories.create(:key => 'fogotherdirectoryname') other_directory = AWS[:storage].directories.create(:key => 'fogotherdirectoryname')
data = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r') data = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
file = @directory.files.create(:key => 'fogfilename', :body => data) file = @directory.files.create(:key => 'fogfilename', :body => data)
other_file = file.copy('fogotherdirectoryname', 'fogotherfilename') other_file = file.copy('fogotherdirectoryname', 'fogotherfilename')

View file

@ -1,9 +1,9 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Fog::AWS::S3::Files' do describe 'Fog::AWS::Storage::Files' do
before(:each) do before(:each) do
@directory = AWS[:s3].directories.create(:key => "fog#{Time.now.to_f}") @directory = AWS[:storage].directories.create(:key => "fog#{Time.now.to_f}")
end end
after(:each) do after(:each) do
@ -16,7 +16,7 @@ describe 'Fog::AWS::S3::Files' do
describe "#initialize" do describe "#initialize" do
it "should remap attributes from parser" do it "should remap attributes from parser" do
files = Fog::AWS::S3::Files.new( files = Fog::AWS::Storage::Files.new(
'IsTruncated' => true, 'IsTruncated' => true,
'Marker' => 'marker', 'Marker' => 'marker',
'MaxKeys' => 1, 'MaxKeys' => 1,
@ -33,7 +33,7 @@ describe 'Fog::AWS::S3::Files' do
describe "#all" do describe "#all" do
it "should return nil if the directory does not exist" do it "should return nil if the directory does not exist" do
directory = AWS[:s3].directories.new(:key => 'notadirectory') directory = AWS[:storage].directories.new(:key => 'notadirectory')
directory.files.all.should be_nil directory.files.all.should be_nil
end end
@ -80,7 +80,7 @@ describe 'Fog::AWS::S3::Files' do
@file.destroy @file.destroy
end end
it "should return a Fog::AWS::S3::File with metadata and data" do it "should return a Fog::AWS::Storage::File with metadata and data" do
@file.reload @file.reload
@file.body.should_not be_nil @file.body.should_not be_nil
@file.content_length.should_not be_nil @file.content_length.should_not be_nil
@ -116,7 +116,7 @@ describe 'Fog::AWS::S3::Files' do
describe "#head" do describe "#head" do
it "should return a Fog::AWS::S3::File with metadata" do it "should return a Fog::AWS::Storage::File with metadata" do
data = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r') data = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
file = @directory.files.create(:key => 'fogfilename', :body => data) file = @directory.files.create(:key => 'fogfilename', :body => data)
file = @directory.files.get('fogfilename') file = @directory.files.get('fogfilename')

View file

@ -1,10 +1,10 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'EC2.describe_images' do describe 'Compute.describe_images' do
describe 'success' do describe 'success' do
it "should return proper attributes with no params" do it "should return proper attributes with no params" do
actual = AWS[:ec2].describe_images actual = AWS[:compute].describe_images
actual.body['requestId'].should be_a(String) actual.body['requestId'].should be_a(String)
image = actual.body['imagesSet'].first image = actual.body['imagesSet'].first
image['architecture'].should be_a(String) image['architecture'].should be_a(String)
@ -21,9 +21,9 @@ describe 'EC2.describe_images' do
["ebs","instance-store"].should include(image['rootDeviceType']) ["ebs","instance-store"].should include(image['rootDeviceType'])
image['rootDeviceName'].should be_a(String) if image['rootDeviceName'] image['rootDeviceName'].should be_a(String) if image['rootDeviceName']
end end
it "should return proper attributes with params" do it "should return proper attributes with params" do
actual = AWS[:ec2].describe_images('ImageId' => GENTOO_AMI) actual = AWS[:compute].describe_images('ImageId' => GENTOO_AMI)
actual.body['requestId'].should be_a(String) actual.body['requestId'].should be_a(String)
image = actual.body['imagesSet'].first image = actual.body['imagesSet'].first
image['architecture'].should be_a(String) image['architecture'].should be_a(String)

View file

@ -1,23 +1,23 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'S3.copy_object' do describe 'Storage.copy_object' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
AWS[:s3].put_bucket('fogcopyobjectsource') AWS[:storage].put_bucket('fogcopyobjectsource')
AWS[:s3].put_object('fogcopyobjectsource', 'fog_copy_object_source', lorem_file) AWS[:storage].put_object('fogcopyobjectsource', 'fog_copy_object_source', lorem_file)
AWS[:s3].put_bucket('fogcopyobjectdestination') AWS[:storage].put_bucket('fogcopyobjectdestination')
end end
after(:each) do after(:each) do
AWS[:s3].delete_object('fogcopyobjectdestination', 'fog_copy_object_destination') AWS[:storage].delete_object('fogcopyobjectdestination', 'fog_copy_object_destination')
AWS[:s3].delete_bucket('fogcopyobjectdestination') AWS[:storage].delete_bucket('fogcopyobjectdestination')
AWS[:s3].delete_object('fogcopyobjectsource', 'fog_copy_object_source') AWS[:storage].delete_object('fogcopyobjectsource', 'fog_copy_object_source')
AWS[:s3].delete_bucket('fogcopyobjectsource') AWS[:storage].delete_bucket('fogcopyobjectsource')
end end
it 'should return proper attributes' do it 'should return proper attributes' do
actual = AWS[:s3].copy_object( actual = AWS[:storage].copy_object(
'fogcopyobjectsource', 'fog_copy_object_source', 'fogcopyobjectsource', 'fog_copy_object_source',
'fogcopyobjectdestination', 'fog_copy_object_destination' 'fogcopyobjectdestination', 'fog_copy_object_destination'
) )
@ -31,7 +31,7 @@ describe 'S3.copy_object' do
it 'should raise a NotFound error if the source_bucket does not exist' do it 'should raise a NotFound error if the source_bucket does not exist' do
lambda { lambda {
AWS[:s3].copy_object( AWS[:storage].copy_object(
'fognotabucket', 'fog_copy_object_source', 'fognotabucket', 'fog_copy_object_source',
'fogcopyobjectdestination', 'fog_copy_object_destination' 'fogcopyobjectdestination', 'fog_copy_object_destination'
) )
@ -40,7 +40,7 @@ describe 'S3.copy_object' do
it 'should raise a NotFound error if the source_object does not exist' do it 'should raise a NotFound error if the source_object does not exist' do
lambda { lambda {
AWS[:s3].copy_object( AWS[:storage].copy_object(
'fogcopyobjectsource', 'fog_not_an_object', 'fogcopyobjectsource', 'fog_not_an_object',
'fogcopyobjectdestination', 'fog_copy_object_destination' 'fogcopyobjectdestination', 'fog_copy_object_destination'
) )
@ -49,7 +49,7 @@ describe 'S3.copy_object' do
it 'should raise a NotFound error if the target_bucket does not exist' do it 'should raise a NotFound error if the target_bucket does not exist' do
lambda { lambda {
AWS[:s3].copy_object( AWS[:storage].copy_object(
'fogcopyobjectsource', 'fog_copy_object_source', 'fogcopyobjectsource', 'fog_copy_object_source',
'fognotabucket', 'fog_copy_object_destination' 'fognotabucket', 'fog_copy_object_destination'
) )

View file

@ -1,14 +1,14 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'S3.delete_bucket' do describe 'Storage.delete_bucket' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
AWS[:s3].put_bucket('fogdeletebucket') AWS[:storage].put_bucket('fogdeletebucket')
end end
it 'should return proper attributes' do it 'should return proper attributes' do
actual = AWS[:s3].delete_bucket('fogdeletebucket') actual = AWS[:storage].delete_bucket('fogdeletebucket')
actual.status.should == 204 actual.status.should == 204
end end
@ -17,18 +17,18 @@ describe 'S3.delete_bucket' do
it 'should raise a NotFound error if the bucket does not exist' do it 'should raise a NotFound error if the bucket does not exist' do
lambda { lambda {
AWS[:s3].delete_bucket('fognotabucket') AWS[:storage].delete_bucket('fognotabucket')
}.should raise_error(Excon::Errors::NotFound) }.should raise_error(Excon::Errors::NotFound)
end end
it 'should raise a Conflict error if the bucket is not empty' do it 'should raise a Conflict error if the bucket is not empty' do
AWS[:s3].put_bucket('fogdeletebucket') AWS[:storage].put_bucket('fogdeletebucket')
AWS[:s3].put_object('fogdeletebucket', 'fog_delete_object', lorem_file) AWS[:storage].put_object('fogdeletebucket', 'fog_delete_object', lorem_file)
lambda { lambda {
AWS[:s3].delete_bucket('fogdeletebucket') AWS[:storage].delete_bucket('fogdeletebucket')
}.should raise_error(Excon::Errors::Conflict) }.should raise_error(Excon::Errors::Conflict)
AWS[:s3].delete_object('fogdeletebucket', 'fog_delete_object') AWS[:storage].delete_object('fogdeletebucket', 'fog_delete_object')
AWS[:s3].delete_bucket('fogdeletebucket') AWS[:storage].delete_bucket('fogdeletebucket')
end end
end end

View file

@ -1,19 +1,19 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'S3.delete_object' do describe 'Storage.delete_object' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
AWS[:s3].put_bucket('fogdeleteobject') AWS[:storage].put_bucket('fogdeleteobject')
AWS[:s3].put_object('fogdeleteobject', 'fog_delete_object', lorem_file) AWS[:storage].put_object('fogdeleteobject', 'fog_delete_object', lorem_file)
end end
after(:each) do after(:each) do
AWS[:s3].delete_bucket('fogdeleteobject') AWS[:storage].delete_bucket('fogdeleteobject')
end end
it 'should return proper attributes' do it 'should return proper attributes' do
actual = AWS[:s3].delete_object('fogdeleteobject', 'fog_delete_object') actual = AWS[:storage].delete_object('fogdeleteobject', 'fog_delete_object')
actual.status.should == 204 actual.status.should == 204
end end
@ -22,14 +22,14 @@ describe 'S3.delete_object' do
it 'should raise a NotFound error if the bucket does not exist' do it 'should raise a NotFound error if the bucket does not exist' do
lambda { lambda {
AWS[:s3].delete_object('fognotabucket', 'fog_delete_object') AWS[:storage].delete_object('fognotabucket', 'fog_delete_object')
}.should raise_error(Excon::Errors::NotFound) }.should raise_error(Excon::Errors::NotFound)
end end
it 'should not raise an error if the object does not exist' do it 'should not raise an error if the object does not exist' do
AWS[:s3].put_bucket('fogdeleteobject') AWS[:storage].put_bucket('fogdeleteobject')
AWS[:s3].delete_object('fogdeleteobject', 'fog_not_an_object') AWS[:storage].delete_object('fogdeleteobject', 'fog_not_an_object')
AWS[:s3].delete_bucket('fogdeleteobject') AWS[:storage].delete_bucket('fogdeleteobject')
end end
end end

View file

@ -1,18 +1,18 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'S3.get_bucket_location' do describe 'Storage.get_bucket_location' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
AWS[:s3].put_bucket('foggetlocation', 'LocationConstraint' => 'EU') AWS[:storage].put_bucket('foggetlocation', 'LocationConstraint' => 'EU')
end end
after(:each) do after(:each) do
AWS[:eu_s3].delete_bucket('foggetlocation') AWS[:eu_storage].delete_bucket('foggetlocation')
end end
it 'should return proper attributes' do it 'should return proper attributes' do
actual = AWS[:s3].get_bucket_location('foggetlocation') actual = AWS[:storage].get_bucket_location('foggetlocation')
actual.status.should == 200 actual.status.should == 200
actual.body['LocationConstraint'].should == 'EU' actual.body['LocationConstraint'].should == 'EU'
end end
@ -22,7 +22,7 @@ describe 'S3.get_bucket_location' do
it 'should raise NotFound error if bucket does not exist' do it 'should raise NotFound error if bucket does not exist' do
lambda { lambda {
AWS[:s3].get_bucket_location('fognotabucket') AWS[:storage].get_bucket_location('fognotabucket')
}.should raise_error(Excon::Errors::NotFound) }.should raise_error(Excon::Errors::NotFound)
end end

View file

@ -1,22 +1,22 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'S3.get_bucket' do describe 'Storage.get_bucket' do
describe 'success' do describe 'success' do
before(:all) do before(:all) do
AWS[:s3].put_bucket('foggetbucket') AWS[:storage].put_bucket('foggetbucket')
AWS[:s3].put_object('foggetbucket', 'fog_object', lorem_file) AWS[:storage].put_object('foggetbucket', 'fog_object', lorem_file)
AWS[:s3].put_object('foggetbucket', 'fog_other_object', lorem_file) AWS[:storage].put_object('foggetbucket', 'fog_other_object', lorem_file)
end end
after(:all) do after(:all) do
AWS[:s3].delete_object('foggetbucket', 'fog_object') AWS[:storage].delete_object('foggetbucket', 'fog_object')
AWS[:s3].delete_object('foggetbucket', 'fog_other_object') AWS[:storage].delete_object('foggetbucket', 'fog_other_object')
AWS[:s3].delete_bucket('foggetbucket') AWS[:storage].delete_bucket('foggetbucket')
end end
it 'should return proper attributes' do it 'should return proper attributes' do
actual = AWS[:s3].get_bucket('foggetbucket') actual = AWS[:storage].get_bucket('foggetbucket')
actual.body['IsTruncated'].should == false actual.body['IsTruncated'].should == false
actual.body['Marker'].should be_nil actual.body['Marker'].should be_nil
actual.body['MaxKeys'].should be_an(Integer) actual.body['MaxKeys'].should be_an(Integer)
@ -36,7 +36,7 @@ describe 'S3.get_bucket' do
end end
it 'should accept marker option' do it 'should accept marker option' do
actual = AWS[:s3].get_bucket('foggetbucket', 'marker' => 'fog_object') actual = AWS[:storage].get_bucket('foggetbucket', 'marker' => 'fog_object')
actual.body['IsTruncated'].should == false actual.body['IsTruncated'].should == false
actual.body['Marker'].should be_a(String) actual.body['Marker'].should be_a(String)
actual.body['MaxKeys'].should be_an(Integer) actual.body['MaxKeys'].should be_an(Integer)
@ -56,7 +56,7 @@ describe 'S3.get_bucket' do
end end
it 'should accept max-keys option' do it 'should accept max-keys option' do
actual = AWS[:s3].get_bucket('foggetbucket', 'max-keys' => 1) actual = AWS[:storage].get_bucket('foggetbucket', 'max-keys' => 1)
actual.body['IsTruncated'].should == true actual.body['IsTruncated'].should == true
actual.body['Marker'].should be_nil actual.body['Marker'].should be_nil
actual.body['MaxKeys'].should be_an(Integer) actual.body['MaxKeys'].should be_an(Integer)
@ -76,7 +76,7 @@ describe 'S3.get_bucket' do
end end
it 'should accept prefix option' do it 'should accept prefix option' do
actual = AWS[:s3].get_bucket('foggetbucket', 'prefix' => 'fog_ob') actual = AWS[:storage].get_bucket('foggetbucket', 'prefix' => 'fog_ob')
actual.body['IsTruncated'].should == false actual.body['IsTruncated'].should == false
actual.body['Marker'].should be_nil actual.body['Marker'].should be_nil
actual.body['MaxKeys'].should be_an(Integer) actual.body['MaxKeys'].should be_an(Integer)
@ -100,13 +100,13 @@ describe 'S3.get_bucket' do
it 'should raise a NotFound error if the bucket does not exist' do it 'should raise a NotFound error if the bucket does not exist' do
lambda { lambda {
AWS[:s3].get_bucket('fognotabucket') AWS[:storage].get_bucket('fognotabucket')
}.should raise_error(Excon::Errors::NotFound) }.should raise_error(Excon::Errors::NotFound)
end end
it 'should request non-subdomain buckets and raise a NotFound error' do it 'should request non-subdomain buckets and raise a NotFound error' do
lambda { lambda {
AWS[:s3].get_bucket('A-invalid--name') AWS[:storage].get_bucket('A-invalid--name')
}.should raise_error(Excon::Errors::NotFound) }.should raise_error(Excon::Errors::NotFound)
end end

View file

@ -1,20 +1,20 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'S3.get_object' do describe 'Storage.get_object' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
AWS[:s3].put_bucket('foggetobject') AWS[:storage].put_bucket('foggetobject')
AWS[:s3].put_object('foggetobject', 'fog_get_object', lorem_file) AWS[:storage].put_object('foggetobject', 'fog_get_object', lorem_file)
end end
after(:each) do after(:each) do
AWS[:s3].delete_object('foggetobject', 'fog_get_object') AWS[:storage].delete_object('foggetobject', 'fog_get_object')
AWS[:s3].delete_bucket('foggetobject') AWS[:storage].delete_bucket('foggetobject')
end end
it 'should return proper attributes' do it 'should return proper attributes' do
actual = AWS[:s3].get_object('foggetobject', 'fog_get_object') actual = AWS[:storage].get_object('foggetobject', 'fog_get_object')
actual.status.should == 200 actual.status.should == 200
data = lorem_file.read data = lorem_file.read
actual.body.should == data actual.body.should == data
@ -26,14 +26,14 @@ describe 'S3.get_object' do
it 'should return chunks with optional block' do it 'should return chunks with optional block' do
data = '' data = ''
AWS[:s3].get_object('foggetobject', 'fog_get_object') do |chunk| AWS[:storage].get_object('foggetobject', 'fog_get_object') do |chunk|
data << chunk data << chunk
end end
data.should == lorem_file.read data.should == lorem_file.read
end end
it 'should return a signed expiring url' do it 'should return a signed expiring url' do
url = AWS[:s3].get_object_url('foggetobject', 'fog_get_object', Time.now + 60 * 10) url = AWS[:storage].get_object_url('foggetobject', 'fog_get_object', Time.now + 60 * 10)
unless Fog.mocking? unless Fog.mocking?
open(url).read.should == lorem_file.read open(url).read.should == lorem_file.read
end end
@ -44,13 +44,13 @@ describe 'S3.get_object' do
it 'should raise a NotFound error if the bucket does not exist' do it 'should raise a NotFound error if the bucket does not exist' do
lambda { lambda {
AWS[:s3].get_object('fognotabucket', 'fog_get_object') AWS[:storage].get_object('fognotabucket', 'fog_get_object')
}.should raise_error(Excon::Errors::NotFound) }.should raise_error(Excon::Errors::NotFound)
end end
it 'should raise a NotFound error if the object does not exist' do it 'should raise a NotFound error if the object does not exist' do
lambda { lambda {
AWS[:s3].get_object('foggetobject', 'fog_not_an_object') AWS[:storage].get_object('foggetobject', 'fog_not_an_object')
}.should raise_error(Excon::Errors::NotFound) }.should raise_error(Excon::Errors::NotFound)
end end

View file

@ -1,18 +1,18 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'S3.get_request_payment' do describe 'Storage.get_request_payment' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
AWS[:s3].put_bucket('foggetrequestpayment') AWS[:storage].put_bucket('foggetrequestpayment')
end end
after(:each) do after(:each) do
AWS[:s3].delete_bucket('foggetrequestpayment') AWS[:storage].delete_bucket('foggetrequestpayment')
end end
it 'should return proper attributes' do it 'should return proper attributes' do
actual = AWS[:s3].get_request_payment('foggetrequestpayment') actual = AWS[:storage].get_request_payment('foggetrequestpayment')
actual.status.should == 200 actual.status.should == 200
actual.body['Payer'].should == 'BucketOwner' actual.body['Payer'].should == 'BucketOwner'
end end
@ -22,7 +22,7 @@ describe 'S3.get_request_payment' do
it 'should raise a NotFound error if the bucket does not exist' do it 'should raise a NotFound error if the bucket does not exist' do
lambda { lambda {
AWS[:s3].get_request_payment('fognotabucket') AWS[:storage].get_request_payment('fognotabucket')
}.should raise_error(Excon::Errors::NotFound) }.should raise_error(Excon::Errors::NotFound)
end end

View file

@ -1,19 +1,19 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'S3.get_service' do describe 'Storage.get_service' do
describe 'success' do describe 'success' do
before(:all) do before(:all) do
AWS[:s3].put_bucket('foggetservice') AWS[:storage].put_bucket('foggetservice')
Fog.wait_for { AWS[:s3].directories.get('foggetservice') } Fog.wait_for { AWS[:storage].directories.get('foggetservice') }
end end
after(:all) do after(:all) do
AWS[:s3].delete_bucket('foggetservice') AWS[:storage].delete_bucket('foggetservice')
end end
it 'should return proper_attributes' do it 'should return proper_attributes' do
actual = AWS[:s3].get_service actual = AWS[:storage].get_service
actual.body['Buckets'].should be_an(Array) actual.body['Buckets'].should be_an(Array)
bucket = actual.body['Buckets'].select {|bucket| bucket['Name'] == 'foggetservice'}.first bucket = actual.body['Buckets'].select {|bucket| bucket['Name'] == 'foggetservice'}.first
bucket['CreationDate'].should be_a(Time) bucket['CreationDate'].should be_a(Time)
@ -24,7 +24,7 @@ describe 'S3.get_service' do
end end
it 'should include foggetservice in get_service' do it 'should include foggetservice in get_service' do
actual = AWS[:s3].get_service actual = AWS[:storage].get_service
actual.body['Buckets'].collect { |bucket| bucket['Name'] }.should include('foggetservice') actual.body['Buckets'].collect { |bucket| bucket['Name'] }.should include('foggetservice')
end end

View file

@ -1,20 +1,20 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'S3.head_object' do describe 'Storage.head_object' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
AWS[:s3].put_bucket('fogheadobject') AWS[:storage].put_bucket('fogheadobject')
AWS[:s3].put_object('fogheadobject', 'fog_head_object', lorem_file) AWS[:storage].put_object('fogheadobject', 'fog_head_object', lorem_file)
end end
after(:each) do after(:each) do
AWS[:s3].delete_object('fogheadobject', 'fog_head_object') AWS[:storage].delete_object('fogheadobject', 'fog_head_object')
AWS[:s3].delete_bucket('fogheadobject') AWS[:storage].delete_bucket('fogheadobject')
end end
it 'should return proper attributes' do it 'should return proper attributes' do
actual = AWS[:s3].head_object('fogheadobject', 'fog_head_object') actual = AWS[:storage].head_object('fogheadobject', 'fog_head_object')
actual.status.should == 200 actual.status.should == 200
data = lorem_file.read data = lorem_file.read
actual.headers['Content-Length'].should == data.length.to_s actual.headers['Content-Length'].should == data.length.to_s

View file

@ -1,18 +1,18 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'S3.put_bucket' do describe 'Storage.put_bucket' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
@response = AWS[:s3].put_bucket('fogputbucket') @response = AWS[:storage].put_bucket('fogputbucket')
end end
after(:each) do after(:each) do
AWS[:s3].delete_bucket('fogputbucket') AWS[:storage].delete_bucket('fogputbucket')
end end
it 'should not raise an error if the bucket already exists' do it 'should not raise an error if the bucket already exists' do
AWS[:s3].put_bucket('fogputbucket') AWS[:storage].put_bucket('fogputbucket')
end end
end end

View file

@ -1,16 +1,16 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'S3.put_object' do describe 'Storage.put_object' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
AWS[:s3].put_bucket('fogputobject') AWS[:storage].put_bucket('fogputobject')
@response = AWS[:s3].put_object('fogputobject', 'fog_put_object', lorem_file) @response = AWS[:storage].put_object('fogputobject', 'fog_put_object', lorem_file)
end end
after(:each) do after(:each) do
AWS[:s3].delete_object('fogputobject', 'fog_put_object') AWS[:storage].delete_object('fogputobject', 'fog_put_object')
AWS[:s3].delete_bucket('fogputobject') AWS[:storage].delete_bucket('fogputobject')
end end
it 'should return proper attributes' do it 'should return proper attributes' do
@ -18,7 +18,7 @@ describe 'S3.put_object' do
end end
it 'should not raise an error if the object already exists' do it 'should not raise an error if the object already exists' do
actual = AWS[:s3].put_object('fogputobject', 'fog_put_object', lorem_file) actual = AWS[:storage].put_object('fogputobject', 'fog_put_object', lorem_file)
actual.status.should == 200 actual.status.should == 200
end end
@ -27,16 +27,16 @@ describe 'S3.put_object' do
it 'should raise a NotFound error if the bucket does not exist' do it 'should raise a NotFound error if the bucket does not exist' do
lambda { lambda {
AWS[:s3].put_object('fognotabucket', 'fog_put_object', lorem_file) AWS[:storage].put_object('fognotabucket', 'fog_put_object', lorem_file)
}.should raise_error(Excon::Errors::NotFound) }.should raise_error(Excon::Errors::NotFound)
end end
it 'should not raise an error if the object already exists' do it 'should not raise an error if the object already exists' do
AWS[:s3].put_bucket('fogputobject') AWS[:storage].put_bucket('fogputobject')
AWS[:s3].put_object('fogputobject', 'fog_put_object', lorem_file) AWS[:storage].put_object('fogputobject', 'fog_put_object', lorem_file)
AWS[:s3].put_object('fogputobject', 'fog_put_object', lorem_file) AWS[:storage].put_object('fogputobject', 'fog_put_object', lorem_file)
AWS[:s3].delete_object('fogputobject', 'fog_put_object') AWS[:storage].delete_object('fogputobject', 'fog_put_object')
AWS[:s3].delete_bucket('fogputobject') AWS[:storage].delete_bucket('fogputobject')
end end
end end

View file

@ -1,18 +1,18 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'S3.put_request_payment' do describe 'Storage.put_request_payment' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
AWS[:s3].put_bucket('fogputrequestpayment') AWS[:storage].put_bucket('fogputrequestpayment')
end end
after(:each) do after(:each) do
AWS[:s3].delete_bucket('fogputrequestpayment') AWS[:storage].delete_bucket('fogputrequestpayment')
end end
it 'should return proper attributes' do it 'should return proper attributes' do
actual = AWS[:s3].put_request_payment('fogputrequestpayment', 'Requester') actual = AWS[:storage].put_request_payment('fogputrequestpayment', 'Requester')
actual.status.should == 200 actual.status.should == 200
end end
@ -21,7 +21,7 @@ describe 'S3.put_request_payment' do
it 'should raise a NotFound error if bucket does not exist' do it 'should raise a NotFound error if bucket does not exist' do
lambda { lambda {
AWS[:s3].put_request_payment('fognotabucket', 'Requester') AWS[:storage].put_request_payment('fognotabucket', 'Requester')
}.should raise_error(Excon::Errors::NotFound) }.should raise_error(Excon::Errors::NotFound)
end end

View file

@ -1,14 +1,14 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/../../../shared_examples/flavors_examples' require File.dirname(__FILE__) + '/../../../shared_examples/flavors_examples'
describe 'Fog::AWS::Rackspace::Flavors' do describe 'Fog::Bluebox::Compute::Flavors' do
it_should_behave_like "Flavors" it_should_behave_like "Flavors"
subject { @flavor = @flavors.all.first } subject { @flavor = @flavors.all.first }
before(:each) do before(:each) do
@flavors = Rackspace[:servers].flavors @flavors = Bluebox[:compute].flavors
end end
end end

View file

@ -1,7 +1,7 @@
require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/../../shared_examples/server_examples' require File.dirname(__FILE__) + '/../../../shared_examples/server_examples'
describe 'Fog::Bluebox::Server' do describe 'Fog::Bluebox::Compute::Server' do
it_should_behave_like "Server" it_should_behave_like "Server"
@ -12,7 +12,7 @@ describe 'Fog::Bluebox::Server' do
} }
before(:each) do before(:each) do
@servers = Bluebox[:blocks].servers @servers = Bluebox[:compute].servers
end end
after(:each) do after(:each) do

View file

@ -1,7 +1,7 @@
require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/../../shared_examples/servers_examples' require File.dirname(__FILE__) + '/../../../shared_examples/servers_examples'
describe 'Fog::Bluebox::Servers' do describe 'Fog::Bluebox::Compute::Servers' do
it_should_behave_like "Servers" it_should_behave_like "Servers"
@ -14,7 +14,7 @@ describe 'Fog::Bluebox::Servers' do
} }
before(:each) do before(:each) do
@servers = Bluebox[:blocks].servers @servers = Bluebox[:compute].servers
end end
after(:each) do after(:each) do

View file

@ -1,14 +0,0 @@
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/../../shared_examples/flavors_examples'
describe 'Fog::Bluebox::Flavors' do
it_should_behave_like "Flavors"
subject { @flavor = @flavors.all.first }
before(:each) do
@flavors = Bluebox[:blocks].flavors
end
end

View file

@ -0,0 +1,14 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/../../../shared_examples/flavors_examples'
describe 'Fog::Rackspace::Compute::Flavors' do
it_should_behave_like "Flavors"
subject { @flavor = @flavors.all.first }
before(:each) do
@flavors = Rackspace[:compute].flavors
end
end

View file

@ -1,15 +1,15 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/../../../shared_examples/server_examples' require File.dirname(__FILE__) + '/../../../shared_examples/server_examples'
describe 'Fog::Rackspace::Servers::Server' do describe 'Fog::Rackspace::Compute::Server' do
it_should_behave_like "Server" it_should_behave_like "Server"
# flavor 1 = 256, image 3 = gentoo 2008.0 # flavor 1 = 256, image 49 = Ubuntu 10.04 LTS (lucid)
subject { @server = @servers.new(:flavor_id => 1, :image_id => 3, :name => 'name') } subject { @server = @servers.new(:flavor_id => 1, :image_id => 49, :name => "fog_#{Time.now.to_i}") }
before(:each) do before(:each) do
@servers = Rackspace[:servers].servers @servers = Rackspace[:compute].servers
end end
after(:each) do after(:each) do

View file

@ -0,0 +1,22 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/../../../shared_examples/servers_examples'
describe 'Fog::Rackspace::Compute::Servers' do
it_should_behave_like "Servers"
# flavor 1 = 256, image 49 = Ubuntu 10.04 LTS (lucid)
subject { @server = @servers.new(:flavor_id => 1, :image_id => 49, :name => "fog_#{Time.now.to_i}") }
before(:each) do
@servers = Rackspace[:compute].servers
end
after(:each) do
if @server && !@server.new_record?
@server.wait_for { ready? }
@server.destroy.should be_true
end
end
end

View file

@ -1,37 +0,0 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.delete_object' do
describe 'success' do
before(:each) do
Rackspace[:files].put_container('container_name')
Rackspace[:files].put_object('container_name', 'object_name', lorem_file)
end
after(:each) do
Rackspace[:files].delete_container('container_name')
end
it "should return proper attributes" do
Rackspace[:files].delete_object('container_name', 'object_name')
end
end
describe 'failure' do
it "should raise a NotFound error if the container does not exist" do
lambda do
Rackspace[:files].delete_object('container_name', 'object_name')
end.should raise_error(Excon::Errors::NotFound)
end
it "should raise a NotFound error if the object does not exist" do
Rackspace[:files].put_container('container_name')
lambda do
Rackspace[:files].delete_object('container_name', 'object_name')
end.should raise_error(Excon::Errors::NotFound)
Rackspace[:files].delete_container('container_name')
end
end
end

View file

@ -1,21 +0,0 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.get_object' do
describe 'success' do
before(:each) do
Rackspace[:files].put_container('container_name')
Rackspace[:files].put_object('container_name', 'object_name', lorem_file)
end
after(:each) do
Rackspace[:files].delete_object('container_name', 'object_name')
Rackspace[:files].delete_container('container_name')
end
it "should return proper attributes" do
Rackspace[:files].get_object('container_name', 'object_name')
end
end
end

View file

@ -1,30 +0,0 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.head_container' do
describe 'success' do
before(:each) do
Rackspace[:files].put_container('container_name')
Rackspace[:files].put_object('container_name', 'object_name', lorem_file)
end
after(:each) do
Rackspace[:files].delete_object('container_name', 'object_name')
Rackspace[:files].delete_container('container_name')
end
it "should return proper attributes" do
Rackspace[:files].head_container('container_name')
end
end
describe 'failure' do
it "should raise a NotFound error if the container does not exist" do
lambda do
Rackspace[:files].head_container('container_name')
end.should raise_error(Excon::Errors::NotFound)
end
end
end

View file

@ -1,19 +0,0 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.head_containers' do
describe 'success' do
before(:each) do
Rackspace[:files].put_container('container_name')
end
after(:each) do
Rackspace[:files].delete_container('container_name')
end
it "should return proper attributes" do
Rackspace[:files].head_containers
end
end
end

View file

@ -1,21 +0,0 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.head_object' do
describe 'success' do
before(:each) do
Rackspace[:files].put_container('container_name')
Rackspace[:files].put_object('container_name', 'object_name', lorem_file)
end
after(:each) do
Rackspace[:files].delete_object('container_name', 'object_name')
Rackspace[:files].delete_container('container_name')
end
it "should return proper attributes" do
Rackspace[:files].head_object('container_name', 'object_name')
end
end
end

View file

@ -1,20 +0,0 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.put_object' do
describe 'success' do
before(:each) do
Rackspace[:files].put_container('container_name')
end
after(:each) do
Rackspace[:files].delete_object('container_name', 'object_name')
Rackspace[:files].delete_container('container_name')
end
it "should return proper attributes" do
Rackspace[:files].put_object('container_name', 'object_name', lorem_file)
end
end
end

View file

@ -1,14 +1,14 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.delete_container' do describe 'Rackspace::Storage.delete_container' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
Rackspace[:files].put_container('container_name') Rackspace[:storage].put_container('container_name')
end end
it "should return proper attributes" do it "should return proper attributes" do
Rackspace[:files].delete_container('container_name') Rackspace[:storage].delete_container('container_name')
end end
end end
@ -16,8 +16,8 @@ describe 'Rackspace::Files.delete_container' do
it "should raise a NotFound error if the container does not exist" do it "should raise a NotFound error if the container does not exist" do
lambda do lambda do
Rackspace[:files].delete_container('container_name') Rackspace[:storage].delete_container('container_name')
end.should raise_error(Excon::Errors::NotFound) end.should raise_error(Fog::Rackspace::Storage::NotFound)
end end
end end

View file

@ -0,0 +1,37 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Storage.delete_object' do
describe 'success' do
before(:each) do
Rackspace[:storage].put_container('container_name')
Rackspace[:storage].put_object('container_name', 'object_name', lorem_file)
end
after(:each) do
Rackspace[:storage].delete_container('container_name')
end
it "should return proper attributes" do
Rackspace[:storage].delete_object('container_name', 'object_name')
end
end
describe 'failure' do
it "should raise a NotFound error if the container does not exist" do
lambda do
Rackspace[:storage].delete_object('container_name', 'object_name')
end.should raise_error(Fog::Rackspace::Storage::NotFound)
end
it "should raise a NotFound error if the object does not exist" do
Rackspace[:storage].put_container('container_name')
lambda do
Rackspace[:storage].delete_object('container_name', 'object_name')
end.should raise_error(Fog::Rackspace::Storage::NotFound)
Rackspace[:storage].delete_container('container_name')
end
end
end

View file

@ -1,20 +1,20 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.get_container' do describe 'Rackspace::Storage.get_container' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
Rackspace[:files].put_container('container_name') Rackspace[:storage].put_container('container_name')
Rackspace[:files].put_object('container_name', 'object_name', lorem_file) Rackspace[:storage].put_object('container_name', 'object_name', lorem_file)
end end
after(:each) do after(:each) do
Rackspace[:files].delete_object('container_name', 'object_name') Rackspace[:storage].delete_object('container_name', 'object_name')
Rackspace[:files].delete_container('container_name') Rackspace[:storage].delete_container('container_name')
end end
it "should return proper attributes" do it "should return proper attributes" do
actual = Rackspace[:files].get_container('container_name').body actual = Rackspace[:storage].get_container('container_name').body
actual.first['bytes'].should be_an(Integer) actual.first['bytes'].should be_an(Integer)
actual.first['content_type'].should be_a(String) actual.first['content_type'].should be_a(String)
actual.first['hash'].should be_a(String) actual.first['hash'].should be_a(String)
@ -27,8 +27,8 @@ describe 'Rackspace::Files.get_container' do
it "should raise a NotFound error if the container does not exist" do it "should raise a NotFound error if the container does not exist" do
lambda do lambda do
Rackspace[:files].get_container('container_name') Rackspace[:storage].get_container('container_name')
end.should raise_error(Excon::Errors::NotFound) end.should raise_error(Fog::Rackspace::Storage::NotFound)
end end
end end

View file

@ -1,18 +1,18 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.get_containers' do describe 'Rackspace::Storage.get_containers' do
describe 'success' do describe 'success' do
before(:each) do before(:each) do
Rackspace[:files].put_container('container_name') Rackspace[:storage].put_container('container_name')
end end
after(:each) do after(:each) do
Rackspace[:files].delete_container('container_name') Rackspace[:storage].delete_container('container_name')
end end
it "should return proper attributes" do it "should return proper attributes" do
actual = Rackspace[:files].get_containers.body actual = Rackspace[:storage].get_containers.body
actual.first['bytes'].should be_an(Integer) actual.first['bytes'].should be_an(Integer)
actual.first['count'].should be_an(Integer) actual.first['count'].should be_an(Integer)
actual.first['name'].should be_a(String) actual.first['name'].should be_a(String)

View file

@ -0,0 +1,21 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Storage.get_object' do
describe 'success' do
before(:each) do
Rackspace[:storage].put_container('container_name')
Rackspace[:storage].put_object('container_name', 'object_name', lorem_file)
end
after(:each) do
Rackspace[:storage].delete_object('container_name', 'object_name')
Rackspace[:storage].delete_container('container_name')
end
it "should return proper attributes" do
Rackspace[:storage].get_object('container_name', 'object_name')
end
end
end

View file

@ -0,0 +1,30 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Storage.head_container' do
describe 'success' do
before(:each) do
Rackspace[:storage].put_container('container_name')
Rackspace[:storage].put_object('container_name', 'object_name', lorem_file)
end
after(:each) do
Rackspace[:storage].delete_object('container_name', 'object_name')
Rackspace[:storage].delete_container('container_name')
end
it "should return proper attributes" do
Rackspace[:storage].head_container('container_name')
end
end
describe 'failure' do
it "should raise a NotFound error if the container does not exist" do
lambda do
Rackspace[:storage].head_container('container_name')
end.should raise_error(Fog::Rackspace::Storage::NotFound)
end
end
end

View file

@ -0,0 +1,19 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Storage.head_containers' do
describe 'success' do
before(:each) do
Rackspace[:storage].put_container('container_name')
end
after(:each) do
Rackspace[:storage].delete_container('container_name')
end
it "should return proper attributes" do
Rackspace[:storage].head_containers
end
end
end

View file

@ -0,0 +1,21 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Storage.head_object' do
describe 'success' do
before(:each) do
Rackspace[:storage].put_container('container_name')
Rackspace[:storage].put_object('container_name', 'object_name', lorem_file)
end
after(:each) do
Rackspace[:storage].delete_object('container_name', 'object_name')
Rackspace[:storage].delete_container('container_name')
end
it "should return proper attributes" do
Rackspace[:storage].head_object('container_name', 'object_name')
end
end
end

View file

@ -1,14 +1,14 @@
require File.dirname(__FILE__) + '/../../../spec_helper' require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.put_container' do describe 'Rackspace::Storage.put_container' do
describe 'success' do describe 'success' do
after(:each) do after(:each) do
Rackspace[:files].delete_container('container_name') Rackspace[:storage].delete_container('container_name')
end end
it "should return proper attributes" do it "should return proper attributes" do
Rackspace[:files].put_container('container_name') Rackspace[:storage].put_container('container_name')
end end
end end

Some files were not shown because too many files have changed in this diff Show more