зеркало из https://github.com/microsoft/fog.git
nicer connection handling for specs, matches bin
This commit is contained in:
Родитель
ea5f87aa3f
Коммит
1b161f4841
|
@ -5,7 +5,7 @@ describe 'Fog::AWS::EC2::Address' do
|
|||
describe "#initialize" do
|
||||
|
||||
it "should remap attributes from parser" do
|
||||
address = ec2.addresses.new(
|
||||
address = AWS[:ec2].addresses.new(
|
||||
'instanceId' => 'i-00000000',
|
||||
'publicIp' => '0.0.0.0'
|
||||
)
|
||||
|
@ -18,11 +18,11 @@ describe 'Fog::AWS::EC2::Address' do
|
|||
describe "#addresses" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Addresses" do
|
||||
ec2.addresses.new.collection.should be_a(Fog::AWS::EC2::Addresses)
|
||||
AWS[:ec2].addresses.new.collection.should be_a(Fog::AWS::EC2::Addresses)
|
||||
end
|
||||
|
||||
it "should be the addresses the address is related to" do
|
||||
addresses = ec2.addresses
|
||||
addresses = AWS[:ec2].addresses
|
||||
addresses.new.collection.should == addresses
|
||||
end
|
||||
|
||||
|
@ -31,7 +31,7 @@ describe 'Fog::AWS::EC2::Address' do
|
|||
describe "#destroy" do
|
||||
|
||||
it "should return true if the address is deleted" do
|
||||
address = ec2.addresses.create
|
||||
address = AWS[:ec2].addresses.create
|
||||
address.destroy.should be_true
|
||||
end
|
||||
|
||||
|
@ -39,8 +39,8 @@ describe 'Fog::AWS::EC2::Address' do
|
|||
|
||||
describe "#server=" do
|
||||
before(:each) do
|
||||
@address = ec2.addresses.new
|
||||
@server = ec2.servers.create(:image_id => GENTOO_AMI)
|
||||
@address = AWS[:ec2].addresses.new
|
||||
@server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
|
@ -61,7 +61,7 @@ describe 'Fog::AWS::EC2::Address' do
|
|||
describe "#reload" do
|
||||
|
||||
before(:each) do
|
||||
@address = ec2.addresses.create
|
||||
@address = AWS[:ec2].addresses.create
|
||||
@reloaded = @address.reload
|
||||
end
|
||||
|
||||
|
@ -82,7 +82,7 @@ describe 'Fog::AWS::EC2::Address' do
|
|||
describe "#save" do
|
||||
|
||||
before(:each) do
|
||||
@address = ec2.addresses.new
|
||||
@address = AWS[:ec2].addresses.new
|
||||
end
|
||||
|
||||
it "should return true when it succeeds" do
|
||||
|
|
|
@ -5,12 +5,12 @@ describe 'Fog::AWS::EC2::Addresses' do
|
|||
describe "#all" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Addresses" do
|
||||
ec2.addresses.all.should be_a(Fog::AWS::EC2::Addresses)
|
||||
AWS[:ec2].addresses.all.should be_a(Fog::AWS::EC2::Addresses)
|
||||
end
|
||||
|
||||
it "should include persisted addresses" do
|
||||
address = ec2.addresses.create
|
||||
ec2.addresses.get(address.public_ip).should_not be_nil
|
||||
address = AWS[:ec2].addresses.create
|
||||
AWS[:ec2].addresses.get(address.public_ip).should_not be_nil
|
||||
address.destroy
|
||||
end
|
||||
|
||||
|
@ -19,7 +19,7 @@ describe 'Fog::AWS::EC2::Addresses' do
|
|||
describe "#create" do
|
||||
|
||||
before(:each) do
|
||||
@address = ec2.addresses.create
|
||||
@address = AWS[:ec2].addresses.create
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
|
@ -31,7 +31,7 @@ describe 'Fog::AWS::EC2::Addresses' do
|
|||
end
|
||||
|
||||
it "should exist on ec2" do
|
||||
ec2.addresses.get(@address.public_ip).should_not be_nil
|
||||
AWS[:ec2].addresses.get(@address.public_ip).should_not be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -39,14 +39,14 @@ describe 'Fog::AWS::EC2::Addresses' do
|
|||
describe "#get" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Address if a matching address exists" do
|
||||
address = ec2.addresses.create
|
||||
get = ec2.addresses.get(address.public_ip)
|
||||
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
|
||||
ec2.addresses.get('0.0.0.0').should be_nil
|
||||
AWS[:ec2].addresses.get('0.0.0.0').should be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -54,7 +54,7 @@ describe 'Fog::AWS::EC2::Addresses' do
|
|||
describe "#new" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Address" do
|
||||
ec2.addresses.new.should be_a(Fog::AWS::EC2::Address)
|
||||
AWS[:ec2].addresses.new.should be_a(Fog::AWS::EC2::Address)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -62,7 +62,7 @@ describe 'Fog::AWS::EC2::Addresses' do
|
|||
describe "#reload" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Addresses" do
|
||||
ec2.addresses.all.reload.should be_a(Fog::AWS::EC2::Addresses)
|
||||
AWS[:ec2].addresses.all.reload.should be_a(Fog::AWS::EC2::Addresses)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ describe 'Fog::AWS::EC2::KeyPair' do
|
|||
describe "#initialize" do
|
||||
|
||||
it "should remap attributes from parser" do
|
||||
key_pair = ec2.key_pairs.new(
|
||||
key_pair = AWS[:ec2].key_pairs.new(
|
||||
'keyFingerprint' => 'fingerprint',
|
||||
'keyMaterial' => 'material',
|
||||
'keyName' => 'name'
|
||||
|
@ -20,11 +20,11 @@ describe 'Fog::AWS::EC2::KeyPair' do
|
|||
describe "#collection" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::KeyPairs" do
|
||||
ec2.key_pairs.new.collection.should be_a(Fog::AWS::EC2::KeyPairs)
|
||||
AWS[:ec2].key_pairs.new.collection.should be_a(Fog::AWS::EC2::KeyPairs)
|
||||
end
|
||||
|
||||
it "should be the key_pairs the keypair is related to" do
|
||||
key_pairs = ec2.key_pairs
|
||||
key_pairs = AWS[:ec2].key_pairs
|
||||
key_pairs.new.collection.should == key_pairs
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ describe 'Fog::AWS::EC2::KeyPair' do
|
|||
describe "#destroy" do
|
||||
|
||||
it "should return true if the key_pair is deleted" do
|
||||
address = ec2.key_pairs.create(:name => 'keyname')
|
||||
address = AWS[:ec2].key_pairs.create(:name => 'keyname')
|
||||
address.destroy.should be_true
|
||||
end
|
||||
|
||||
|
@ -42,7 +42,7 @@ describe 'Fog::AWS::EC2::KeyPair' do
|
|||
describe "#reload" do
|
||||
|
||||
before(:each) do
|
||||
@key_pair = ec2.key_pairs.create(:name => 'keyname')
|
||||
@key_pair = AWS[:ec2].key_pairs.create(:name => 'keyname')
|
||||
@reloaded = @key_pair.reload
|
||||
end
|
||||
|
||||
|
@ -63,7 +63,7 @@ describe 'Fog::AWS::EC2::KeyPair' do
|
|||
describe "#save" do
|
||||
|
||||
before(:each) do
|
||||
@key_pair = ec2.key_pairs.new(:name => 'keyname')
|
||||
@key_pair = AWS[:ec2].key_pairs.new(:name => 'keyname')
|
||||
end
|
||||
|
||||
it "should return true when it succeeds" do
|
||||
|
@ -72,12 +72,12 @@ describe 'Fog::AWS::EC2::KeyPair' do
|
|||
end
|
||||
|
||||
it "should not exist in key_pairs before save" do
|
||||
ec2.key_pairs.get(@key_pair.name).should be_nil
|
||||
AWS[:ec2].key_pairs.get(@key_pair.name).should be_nil
|
||||
end
|
||||
|
||||
it "should exist in buckets after save" do
|
||||
@key_pair.save
|
||||
ec2.key_pairs.get(@key_pair.name).should_not be_nil
|
||||
AWS[:ec2].key_pairs.get(@key_pair.name).should_not be_nil
|
||||
@key_pair.destroy
|
||||
end
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ describe 'Fog::AWS::EC2::KeyPairs' do
|
|||
describe "#all" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::KeyPairs" do
|
||||
ec2.key_pairs.all.should be_a(Fog::AWS::EC2::KeyPairs)
|
||||
AWS[:ec2].key_pairs.all.should be_a(Fog::AWS::EC2::KeyPairs)
|
||||
end
|
||||
|
||||
it "should include persisted key_pairs" do
|
||||
key_pair = ec2.key_pairs.create(:name => 'keyname')
|
||||
ec2.key_pairs.get(key_pair.name).should_not be_nil
|
||||
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
|
||||
|
||||
|
@ -19,7 +19,7 @@ describe 'Fog::AWS::EC2::KeyPairs' do
|
|||
describe "#create" do
|
||||
|
||||
before(:each) do
|
||||
@key_pair = ec2.key_pairs.create(:name => 'keyname')
|
||||
@key_pair = AWS[:ec2].key_pairs.create(:name => 'keyname')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
|
@ -31,7 +31,7 @@ describe 'Fog::AWS::EC2::KeyPairs' do
|
|||
end
|
||||
|
||||
it "should exist on ec2" do
|
||||
ec2.key_pairs.get(@key_pair.name).should_not be_nil
|
||||
AWS[:ec2].key_pairs.get(@key_pair.name).should_not be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -39,15 +39,15 @@ describe 'Fog::AWS::EC2::KeyPairs' do
|
|||
describe "#get" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::KeyPair if a matching key_pair exists" do
|
||||
key_pair = ec2.key_pairs.create(:name => 'keyname')
|
||||
get = ec2.key_pairs.get(key_pair.name)
|
||||
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
|
||||
ec2.key_pairs.get('notakeyname').should be_nil
|
||||
AWS[:ec2].key_pairs.get('notakeyname').should be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -55,7 +55,7 @@ describe 'Fog::AWS::EC2::KeyPairs' do
|
|||
describe "#new" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::KeyPair" do
|
||||
ec2.key_pairs.new(:name => 'keyname').should be_a(Fog::AWS::EC2::KeyPair)
|
||||
AWS[:ec2].key_pairs.new(:name => 'keyname').should be_a(Fog::AWS::EC2::KeyPair)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -63,7 +63,7 @@ describe 'Fog::AWS::EC2::KeyPairs' do
|
|||
describe "#reload" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::KeyPairs" do
|
||||
ec2.key_pairs.all.reload.should be_a(Fog::AWS::EC2::KeyPairs)
|
||||
AWS[:ec2].key_pairs.all.reload.should be_a(Fog::AWS::EC2::KeyPairs)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
|
|||
describe "#initialize" do
|
||||
|
||||
it "should remap attributes from parser" do
|
||||
security_group = ec2.security_groups.new(
|
||||
security_group = AWS[:ec2].security_groups.new(
|
||||
'groupDescription' => 'description',
|
||||
'groupName' => 'name',
|
||||
'ipPermissions' => 'permissions',
|
||||
|
@ -22,11 +22,11 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
|
|||
describe "#collection" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::SecurityGroups" do
|
||||
ec2.security_groups.new.collection.should be_a(Fog::AWS::EC2::SecurityGroups)
|
||||
AWS[:ec2].security_groups.new.collection.should be_a(Fog::AWS::EC2::SecurityGroups)
|
||||
end
|
||||
|
||||
it "should be the security_groups the keypair is related to" do
|
||||
security_groups = ec2.security_groups
|
||||
security_groups = AWS[:ec2].security_groups
|
||||
security_groups.new.collection.should == security_groups
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
|
|||
describe "#destroy" do
|
||||
|
||||
it "should return true if the security_group is deleted" do
|
||||
address = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
||||
address = AWS[:ec2].security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
||||
address.destroy.should be_true
|
||||
end
|
||||
|
||||
|
@ -44,7 +44,7 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
|
|||
describe "#reload" do
|
||||
|
||||
before(:each) do
|
||||
@security_group = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
||||
@security_group = AWS[:ec2].security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
||||
@reloaded = @security_group.reload
|
||||
end
|
||||
|
||||
|
@ -65,7 +65,7 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
|
|||
describe "#save" do
|
||||
|
||||
before(:each) do
|
||||
@security_group = ec2.security_groups.new(:description => 'groupdescription', :name => 'keyname')
|
||||
@security_group = AWS[:ec2].security_groups.new(:description => 'groupdescription', :name => 'keyname')
|
||||
end
|
||||
|
||||
it "should return true when it succeeds" do
|
||||
|
@ -74,12 +74,12 @@ describe 'Fog::AWS::EC2::SecurityGroup' do
|
|||
end
|
||||
|
||||
it "should not exist in security_groups before save" do
|
||||
ec2.security_groups.get(@security_group.name).should be_nil
|
||||
AWS[:ec2].security_groups.get(@security_group.name).should be_nil
|
||||
end
|
||||
|
||||
it "should exist in buckets after save" do
|
||||
@security_group.save
|
||||
ec2.security_groups.get(@security_group.name).should_not be_nil
|
||||
AWS[:ec2].security_groups.get(@security_group.name).should_not be_nil
|
||||
@security_group.destroy
|
||||
end
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ describe 'Fog::AWS::EC2::SecurityGroups' do
|
|||
describe "#all" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::SecurityGroups" do
|
||||
ec2.security_groups.all.should be_a(Fog::AWS::EC2::SecurityGroups)
|
||||
AWS[:ec2].security_groups.all.should be_a(Fog::AWS::EC2::SecurityGroups)
|
||||
end
|
||||
|
||||
it "should include persisted security_groups" do
|
||||
security_group = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
||||
ec2.security_groups.get(security_group.name).should_not be_nil
|
||||
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
|
||||
|
||||
|
@ -19,7 +19,7 @@ describe 'Fog::AWS::EC2::SecurityGroups' do
|
|||
describe "#create" do
|
||||
|
||||
before(:each) do
|
||||
@security_group = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
||||
@security_group = AWS[:ec2].security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
|
@ -31,7 +31,7 @@ describe 'Fog::AWS::EC2::SecurityGroups' do
|
|||
end
|
||||
|
||||
it "should exist on ec2" do
|
||||
ec2.security_groups.get(@security_group.name).should_not be_nil
|
||||
AWS[:ec2].security_groups.get(@security_group.name).should_not be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -39,15 +39,15 @@ describe 'Fog::AWS::EC2::SecurityGroups' do
|
|||
describe "#get" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::SecurityGroup if a matching security_group exists" do
|
||||
security_group = ec2.security_groups.create(:description => 'groupdescription', :name => 'keyname')
|
||||
get = ec2.security_groups.get(security_group.name)
|
||||
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
|
||||
ec2.security_groups.get('notasecuritygroupname').should be_nil
|
||||
AWS[:ec2].security_groups.get('notasecuritygroupname').should be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -55,7 +55,7 @@ describe 'Fog::AWS::EC2::SecurityGroups' do
|
|||
describe "#new" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::SecurityGroup" do
|
||||
ec2.security_groups.new(:description => 'groupdescription', :name => 'keyname').should be_a(Fog::AWS::EC2::SecurityGroup)
|
||||
AWS[:ec2].security_groups.new(:description => 'groupdescription', :name => 'keyname').should be_a(Fog::AWS::EC2::SecurityGroup)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -63,7 +63,7 @@ describe 'Fog::AWS::EC2::SecurityGroups' do
|
|||
describe "#reload" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::SecurityGroups" do
|
||||
ec2.security_groups.all.reload.should be_a(Fog::AWS::EC2::SecurityGroups)
|
||||
AWS[:ec2].security_groups.all.reload.should be_a(Fog::AWS::EC2::SecurityGroups)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ describe 'Fog::AWS::EC2::Server' do
|
|||
subject { @server = @servers.new(:image_id => GENTOO_AMI) }
|
||||
|
||||
before(:each) do
|
||||
@servers = ec2.servers
|
||||
@servers = AWS[:ec2].servers
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
|
|
|
@ -5,7 +5,7 @@ describe 'Fog::AWS::EC2::Servers' do
|
|||
subject { @server = @servers.create(:image_id => GENTOO_AMI) }
|
||||
|
||||
before(:each) do
|
||||
@servers = ec2.servers
|
||||
@servers = AWS[:ec2].servers
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
|
|
|
@ -5,7 +5,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
describe "#initialize" do
|
||||
|
||||
it "should remap attributes from parser" do
|
||||
snapshot = ec2.snapshots.new(
|
||||
snapshot = AWS[:ec2].snapshots.new(
|
||||
'snapshotId' => 'snap-00000000',
|
||||
'startTime' => 'now',
|
||||
'volumeId' => 'vol-00000000'
|
||||
|
@ -20,11 +20,11 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
describe "#collection" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Snapshots" do
|
||||
ec2.snapshots.new.collection.should be_a(Fog::AWS::EC2::Snapshots)
|
||||
AWS[:ec2].snapshots.new.collection.should be_a(Fog::AWS::EC2::Snapshots)
|
||||
end
|
||||
|
||||
it "should be the snapshots the snapshot is related to" do
|
||||
snapshots = ec2.snapshots
|
||||
snapshots = AWS[:ec2].snapshots
|
||||
snapshots.new.collection.should == snapshots
|
||||
end
|
||||
|
||||
|
@ -33,7 +33,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
describe "#destroy" do
|
||||
|
||||
it "should return true if the snapshot is deleted" do
|
||||
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
snapshot = volume.snapshots.create
|
||||
snapshot.wait_for { status == "completed" }
|
||||
snapshot.destroy.should be_true
|
||||
|
@ -45,7 +45,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
describe "#reload" do
|
||||
|
||||
before(:each) do
|
||||
@volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
@snapshot = @volume.snapshots.create
|
||||
@reloaded = @snapshot.reload
|
||||
end
|
||||
|
@ -68,7 +68,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
describe "#save" do
|
||||
|
||||
before(:each) do
|
||||
@volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
@snapshot = @volume.snapshots.new
|
||||
end
|
||||
|
||||
|
@ -82,12 +82,12 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
end
|
||||
|
||||
it "should not exist in addresses before save" do
|
||||
ec2.snapshots.get(@snapshot.id).should be_nil
|
||||
AWS[:ec2].snapshots.get(@snapshot.id).should be_nil
|
||||
end
|
||||
|
||||
it "should exist in buckets after save" do
|
||||
@snapshot.save
|
||||
ec2.snapshots.get(@snapshot.id).should_not be_nil
|
||||
AWS[:ec2].snapshots.get(@snapshot.id).should_not be_nil
|
||||
@snapshot.destroy
|
||||
end
|
||||
|
||||
|
|
|
@ -5,20 +5,20 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
describe "#all" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Snapshots" do
|
||||
ec2.snapshots.all.should be_a(Fog::AWS::EC2::Snapshots)
|
||||
AWS[:ec2].snapshots.all.should be_a(Fog::AWS::EC2::Snapshots)
|
||||
end
|
||||
|
||||
it "should include persisted snapshots" do
|
||||
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
snapshot = volume.snapshots.create
|
||||
ec2.snapshots.all.map {|snapshot| snapshot.id}.should include(snapshot.id)
|
||||
AWS[:ec2].snapshots.all.map {|snapshot| snapshot.id}.should include(snapshot.id)
|
||||
snapshot.destroy
|
||||
volume.destroy
|
||||
end
|
||||
|
||||
it "should limit snapshots by volume if present" do
|
||||
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
other_volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
other_volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
snapshot = volume.snapshots.create
|
||||
other_volume.snapshots.all.map {|snapshot| snapshot.id}.should_not include(snapshot.id)
|
||||
snapshot.destroy
|
||||
|
@ -31,7 +31,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
describe "#create" do
|
||||
|
||||
before(:each) do
|
||||
@volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
@snapshot = @volume.snapshots.create
|
||||
end
|
||||
|
||||
|
@ -45,7 +45,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
end
|
||||
|
||||
it "should exist on ec2" do
|
||||
ec2.snapshots.get(@snapshot.id).should_not be_nil
|
||||
AWS[:ec2].snapshots.get(@snapshot.id).should_not be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -53,15 +53,15 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
describe "#get" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Snapshot if a matching snapshot exists" do
|
||||
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
snapshot = volume.snapshots.create
|
||||
get = ec2.snapshots.get(snapshot.id)
|
||||
get = AWS[:ec2].snapshots.get(snapshot.id)
|
||||
snapshot.attributes.reject {|key, value| [:progress, :status].include?(key)}.should == get.attributes.reject {|key, value| [:progress, :status].include?(key)}
|
||||
snapshot.destroy
|
||||
end
|
||||
|
||||
it "should return nil if no matching address exists" do
|
||||
ec2.snapshots.get('vol-00000000').should be_nil
|
||||
AWS[:ec2].snapshots.get('vol-00000000').should be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -69,7 +69,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
describe "#new" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Snapshot" do
|
||||
ec2.snapshots.new.should be_a(Fog::AWS::EC2::Snapshot)
|
||||
AWS[:ec2].snapshots.new.should be_a(Fog::AWS::EC2::Snapshot)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -77,7 +77,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|||
describe "#reload" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Snapshots" do
|
||||
ec2.snapshots.all.reload.should be_a(Fog::AWS::EC2::Snapshots)
|
||||
AWS[:ec2].snapshots.all.reload.should be_a(Fog::AWS::EC2::Snapshots)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ describe 'Fog::AWS::EC2::Volume' do
|
|||
describe "#initialize" do
|
||||
|
||||
it "should remap attributes from parser" do
|
||||
volume = ec2.volumes.new(
|
||||
volume = AWS[:ec2].volumes.new(
|
||||
'attachTime' => 'now',
|
||||
'availabilityZone' => 'us-east-1a',
|
||||
'createTime' => 'recently',
|
||||
|
@ -26,11 +26,11 @@ describe 'Fog::AWS::EC2::Volume' do
|
|||
describe "#collection" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Volumes" do
|
||||
ec2.volumes.new.collection.should be_a(Fog::AWS::EC2::Volumes)
|
||||
AWS[:ec2].volumes.new.collection.should be_a(Fog::AWS::EC2::Volumes)
|
||||
end
|
||||
|
||||
it "should be the volumes the volume is related to" do
|
||||
volumes = ec2.volumes
|
||||
volumes = AWS[:ec2].volumes
|
||||
volumes.new.collection.should == volumes
|
||||
end
|
||||
|
||||
|
@ -39,7 +39,7 @@ describe 'Fog::AWS::EC2::Volume' do
|
|||
describe "#destroy" do
|
||||
|
||||
it "should return true if the volume is deleted" do
|
||||
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
||||
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
||||
volume.destroy.should be_true
|
||||
end
|
||||
|
||||
|
@ -47,8 +47,8 @@ describe 'Fog::AWS::EC2::Volume' do
|
|||
|
||||
describe "#server=" do
|
||||
before(:each) do
|
||||
@server = ec2.servers.create(:image_id => GENTOO_AMI)
|
||||
@volume = ec2.volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
|
||||
@server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
|
||||
@volume = AWS[:ec2].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
|
||||
@server.wait_for { state == 'running' }
|
||||
end
|
||||
|
||||
|
@ -94,7 +94,7 @@ describe 'Fog::AWS::EC2::Volume' do
|
|||
describe "#reload" do
|
||||
|
||||
before(:each) do
|
||||
@volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
||||
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
||||
@reloaded = @volume.reload
|
||||
end
|
||||
|
||||
|
@ -115,7 +115,7 @@ describe 'Fog::AWS::EC2::Volume' do
|
|||
describe "#save" do
|
||||
|
||||
before(:each) do
|
||||
@volume = ec2.volumes.new(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
||||
@volume = AWS[:ec2].volumes.new(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
||||
end
|
||||
|
||||
it "should return true when it succeeds" do
|
||||
|
@ -124,12 +124,12 @@ describe 'Fog::AWS::EC2::Volume' do
|
|||
end
|
||||
|
||||
it "should not exist in volumes before save" do
|
||||
ec2.volumes.get(@volume.id).should be_nil
|
||||
AWS[:ec2].volumes.get(@volume.id).should be_nil
|
||||
end
|
||||
|
||||
it "should exist in buckets after save" do
|
||||
@volume.save
|
||||
ec2.volumes.get(@volume.id).should_not be_nil
|
||||
AWS[:ec2].volumes.get(@volume.id).should_not be_nil
|
||||
@volume.destroy
|
||||
end
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|||
describe "#all" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Volumes" do
|
||||
ec2.volumes.all.should be_a(Fog::AWS::EC2::Volumes)
|
||||
AWS[:ec2].volumes.all.should be_a(Fog::AWS::EC2::Volumes)
|
||||
end
|
||||
|
||||
it "should include persisted volumes" do
|
||||
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
ec2.volumes.get(volume.id).should_not be_nil
|
||||
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
|
||||
|
||||
|
@ -19,7 +19,7 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|||
describe "#create" do
|
||||
|
||||
before(:each) do
|
||||
@volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
|
@ -31,7 +31,7 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|||
end
|
||||
|
||||
it "should exist on ec2" do
|
||||
ec2.volumes.get(@volume.id).should_not be_nil
|
||||
AWS[:ec2].volumes.get(@volume.id).should_not be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -39,14 +39,14 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|||
describe "#get" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Volume if a matching volume exists" do
|
||||
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
get = ec2.volumes.get(volume.id)
|
||||
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
||||
get = AWS[:ec2].volumes.get(volume.id)
|
||||
volume.attributes.reject { |key, value| [:device, :status].include?(key) }.should == get.attributes.reject { |key, value| [:device, :status].include?(key) }
|
||||
volume.destroy
|
||||
end
|
||||
|
||||
it "should return nil if no matching address exists" do
|
||||
ec2.volumes.get('vol-00000000').should be_nil
|
||||
AWS[:ec2].volumes.get('vol-00000000').should be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -54,7 +54,7 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|||
describe "#new" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Volume" do
|
||||
ec2.volumes.new.should be_a(Fog::AWS::EC2::Volume)
|
||||
AWS[:ec2].volumes.new.should be_a(Fog::AWS::EC2::Volume)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -62,7 +62,7 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|||
describe "#reload" do
|
||||
|
||||
it "should return a Fog::AWS::EC2::Volumes" do
|
||||
ec2.volumes.all.reload.should be_a(Fog::AWS::EC2::Volumes)
|
||||
AWS[:ec2].volumes.all.reload.should be_a(Fog::AWS::EC2::Volumes)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,8 +5,8 @@ describe 'Fog::AWS::S3::Directories' do
|
|||
describe "#all" do
|
||||
|
||||
it "should include persisted directories" do
|
||||
@directory = s3.directories.create(:name => 'fogdirectoryname')
|
||||
s3.directories.all.map {|directory| @directory.name}.should include('fogdirectoryname')
|
||||
@directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
|
||||
AWS[:s3].directories.all.map {|directory| @directory.name}.should include('fogdirectoryname')
|
||||
@directory.destroy
|
||||
end
|
||||
|
||||
|
@ -15,8 +15,8 @@ describe 'Fog::AWS::S3::Directories' do
|
|||
describe "#create" do
|
||||
|
||||
it "should exist on s3" do
|
||||
directory = s3.directories.create(:name => 'fogdirectoryname')
|
||||
s3.directories.get(directory.name).should_not be_nil
|
||||
directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
|
||||
AWS[:s3].directories.get(directory.name).should_not be_nil
|
||||
directory.destroy
|
||||
end
|
||||
|
||||
|
@ -25,14 +25,14 @@ describe 'Fog::AWS::S3::Directories' do
|
|||
describe "#get" do
|
||||
|
||||
it "should return a Fog::AWS::S3::Directory if a matching directory exists" do
|
||||
directory = s3.directories.create(:name => 'fogdirectoryname')
|
||||
get = s3.directories.get('fogdirectoryname')
|
||||
directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
|
||||
get = AWS[:s3].directories.get('fogdirectoryname')
|
||||
directory.attributes.should == get.attributes
|
||||
directory.destroy
|
||||
end
|
||||
|
||||
it "should return nil if no matching directory exists" do
|
||||
s3.directories.get('fogdirectoryname').should be_nil
|
||||
AWS[:s3].directories.get('fogdirectoryname').should be_nil
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -40,7 +40,7 @@ describe 'Fog::AWS::S3::Directories' do
|
|||
describe "#reload" do
|
||||
|
||||
it "should reload data" do
|
||||
directories = s3.directories
|
||||
directories = AWS[:s3].directories
|
||||
directories.should == directories.reload
|
||||
end
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ describe 'Fog::AWS::S3::Directory' do
|
|||
describe "#collection" do
|
||||
|
||||
it "should be the directories the directory is related to" do
|
||||
directories = s3.directories
|
||||
directories = AWS[:s3].directories
|
||||
directories.new.collection.should == directories
|
||||
end
|
||||
|
||||
|
@ -28,12 +28,12 @@ describe 'Fog::AWS::S3::Directory' do
|
|||
describe "#destroy" do
|
||||
|
||||
it "should return true if the directory is deleted" do
|
||||
directory = s3.directories.create(:name => 'fogmodeldirectory')
|
||||
directory = AWS[:s3].directories.create(:name => 'fogmodeldirectory')
|
||||
directory.destroy.should be_true
|
||||
end
|
||||
|
||||
it "should return false if the directory does not exist" do
|
||||
directory = s3.directories.new(:name => 'fogmodeldirectory')
|
||||
directory = AWS[:s3].directories.new(:name => 'fogmodeldirectory')
|
||||
directory.destroy.should be_false
|
||||
end
|
||||
|
||||
|
@ -42,9 +42,9 @@ describe 'Fog::AWS::S3::Directory' do
|
|||
describe "#location" do
|
||||
|
||||
it "should return the location constraint" do
|
||||
directory = s3.directories.create(:name => 'fogmodeleudirectory', :location => 'EU')
|
||||
directory = AWS[:s3].directories.create(:name => 'fogmodeleudirectory', :location => 'EU')
|
||||
directory.location.should == 'EU'
|
||||
eu_s3.directories.get('fogmodeleudirectory').destroy
|
||||
AWS[:eu_s3].directories.get('fogmodeleudirectory').destroy
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -52,7 +52,7 @@ describe 'Fog::AWS::S3::Directory' do
|
|||
describe "#payer" do
|
||||
|
||||
it "should return the request payment value" do
|
||||
directory = s3.directories.create(:name => 'fogmodeldirectory')
|
||||
directory = AWS[:s3].directories.create(:name => 'fogmodeldirectory')
|
||||
directory.payer.should == 'BucketOwner'
|
||||
directory.destroy.should be_true
|
||||
end
|
||||
|
@ -62,7 +62,7 @@ describe 'Fog::AWS::S3::Directory' do
|
|||
describe "#payer=" do
|
||||
|
||||
it "should set the request payment value" do
|
||||
directory = s3.directories.create(:name => 'fogmodeldirectory')
|
||||
directory = AWS[:s3].directories.create(:name => 'fogmodeldirectory')
|
||||
(directory.payer = 'Requester').should == 'Requester'
|
||||
directory.destroy.should
|
||||
end
|
||||
|
@ -72,7 +72,7 @@ describe 'Fog::AWS::S3::Directory' do
|
|||
describe "#reload" do
|
||||
|
||||
before(:each) do
|
||||
@directory = s3.directories.create(:name => 'fogmodeldirectory')
|
||||
@directory = AWS[:s3].directories.create(:name => 'fogmodeldirectory')
|
||||
@reloaded = @directory.reload
|
||||
end
|
||||
|
||||
|
@ -89,7 +89,7 @@ describe 'Fog::AWS::S3::Directory' do
|
|||
describe "#save" do
|
||||
|
||||
before(:each) do
|
||||
@directory = s3.directories.new(:name => 'fogmodeldirectory')
|
||||
@directory = AWS[:s3].directories.new(:name => 'fogmodeldirectory')
|
||||
end
|
||||
|
||||
it "should return true when it succeeds" do
|
||||
|
@ -98,12 +98,12 @@ describe 'Fog::AWS::S3::Directory' do
|
|||
end
|
||||
|
||||
it "should not exist in directories before save" do
|
||||
s3.directories.all.map {|directory| directory.name}.include?(@directory.name).should be_false
|
||||
AWS[:s3].directories.all.map {|directory| directory.name}.include?(@directory.name).should be_false
|
||||
end
|
||||
|
||||
it "should exist in directories after save" do
|
||||
@directory.save
|
||||
s3.directories.all.map {|directory| directory.name}.include?(@directory.name).should be_true
|
||||
AWS[:s3].directories.all.map {|directory| directory.name}.include?(@directory.name).should be_true
|
||||
@directory.destroy
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|||
describe 'Fog::AWS::S3::File' do
|
||||
|
||||
before(:each) do
|
||||
@directory = s3.directories.create(:name => 'fogdirectoryname')
|
||||
@directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
|
@ -53,7 +53,7 @@ describe 'Fog::AWS::S3::File' do
|
|||
describe "#copy" do
|
||||
|
||||
it "should return a Fog::AWS::S3::File with matching attributes" do
|
||||
other_directory = s3.directories.create(:name => 'fogotherdirectoryname')
|
||||
other_directory = AWS[:s3].directories.create(:name => 'fogotherdirectoryname')
|
||||
data = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
||||
file = @directory.files.create(:key => 'fogfilename', :body => data)
|
||||
other_file = file.copy('fogotherdirectoryname', 'fogotherfilename')
|
||||
|
|
|
@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|||
describe 'Fog::AWS::S3::Files' do
|
||||
|
||||
before(:each) do
|
||||
@directory = s3.directories.create(:name => 'fogdirectoryname')
|
||||
@directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
|
@ -30,7 +30,7 @@ describe 'Fog::AWS::S3::Files' do
|
|||
describe "#all" do
|
||||
|
||||
it "should return nil if the directory does not exist" do
|
||||
directory = s3.directories.new(:name => 'notadirectory')
|
||||
directory = AWS[:s3].directories.new(:name => 'notadirectory')
|
||||
directory.files.all.should be_nil
|
||||
end
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ describe 'EC2.allocate_address' do
|
|||
describe 'success' do
|
||||
|
||||
after(:each) do
|
||||
ec2.release_address(@public_ip)
|
||||
AWS[:ec2].release_address(@public_ip)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.allocate_address
|
||||
actual = AWS[:ec2].allocate_address
|
||||
actual.body['requestId'].should be_a(String)
|
||||
@public_ip = actual.body['publicIp']
|
||||
actual.body['publicIp'].should be_a(String)
|
||||
|
|
|
@ -4,17 +4,17 @@ describe 'EC2.associate_address' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.release_address(@public_ip)
|
||||
ec2.terminate_instances(@instance_id)
|
||||
AWS[:ec2].release_address(@public_ip)
|
||||
AWS[:ec2].terminate_instances(@instance_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.associate_address(@instance_id, @public_ip)
|
||||
actual = AWS[:ec2].associate_address(@instance_id, @public_ip)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
@ -23,19 +23,19 @@ describe 'EC2.associate_address' do
|
|||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the instance does not exist" do
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
||||
lambda {
|
||||
ec2.associate_address('i-00000000', @public_ip)
|
||||
AWS[:ec2].associate_address('i-00000000', @public_ip)
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
ec2.release_address(@public_ip)
|
||||
AWS[:ec2].release_address(@public_ip)
|
||||
end
|
||||
|
||||
it "should raise a BadRequest error if the address does not exist" do
|
||||
@instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
lambda {
|
||||
ec2.associate_address(@instance_id, '127.0.0.1')
|
||||
AWS[:ec2].associate_address(@instance_id, '127.0.0.1')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
ec2.terminate_instances(@instance_id)
|
||||
AWS[:ec2].terminate_instances(@instance_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,23 +4,23 @@ describe 'EC2.attach_volume' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
eventually do
|
||||
ec2.detach_volume(@volume_id)
|
||||
AWS[:ec2].detach_volume(@volume_id)
|
||||
end
|
||||
eventually do
|
||||
ec2.delete_volume(@volume_id)
|
||||
ec2.terminate_instances(@instance_id)
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
AWS[:ec2].terminate_instances(@instance_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
eventually(128) do
|
||||
actual = ec2.attach_volume(@instance_id, @volume_id, '/dev/sdh')
|
||||
actual = AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh')
|
||||
actual.body['attachTime'].should be_a(Time)
|
||||
actual.body['device'].should be_a(String)
|
||||
actual.body['instanceId'].should be_a(String)
|
||||
|
@ -34,19 +34,19 @@ describe 'EC2.attach_volume' do
|
|||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the instance does not exist" do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
lambda {
|
||||
ec2.attach_volume('i-00000000', @volume_id, '/dev/sdh')
|
||||
AWS[:ec2].attach_volume('i-00000000', @volume_id, '/dev/sdh')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
ec2.delete_volume(@volume_id)
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
it "should raise a BadRequest error if the address does not exist" do
|
||||
@instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
lambda {
|
||||
ec2.attach_volume(@instance_id, 'vol-00000000', '/dev/sdh')
|
||||
AWS[:ec2].attach_volume(@instance_id, 'vol-00000000', '/dev/sdh')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
ec2.terminate_instances(@instance_id)
|
||||
AWS[:ec2].terminate_instances(@instance_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'EC2.authorize_security_group_ingress' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_security_group('fog_security_group')
|
||||
AWS[:ec2].delete_security_group('fog_security_group')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.authorize_security_group_ingress({
|
||||
actual = AWS[:ec2].authorize_security_group_ingress({
|
||||
'FromPort' => 80,
|
||||
'GroupName' => 'fog_security_group',
|
||||
'IpProtocol' => 'tcp',
|
||||
|
|
|
@ -4,11 +4,11 @@ describe 'EC2.create_key_pair' do
|
|||
describe 'success' do
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_key_pair('fog_key_pair')
|
||||
AWS[:ec2].delete_key_pair('fog_key_pair')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.create_key_pair('fog_key_pair')
|
||||
actual = AWS[:ec2].create_key_pair('fog_key_pair')
|
||||
actual.body['keyFingerprint'].should be_a(String)
|
||||
actual.body['keyMaterial'].should be_a(String)
|
||||
actual.body['keyName'].should be_a(String)
|
||||
|
@ -19,16 +19,16 @@ describe 'EC2.create_key_pair' do
|
|||
describe 'failure' do
|
||||
|
||||
before(:each) do
|
||||
ec2.create_key_pair('fog_key_pair')
|
||||
AWS[:ec2].create_key_pair('fog_key_pair')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_key_pair('fog_key_pair')
|
||||
AWS[:ec2].delete_key_pair('fog_key_pair')
|
||||
end
|
||||
|
||||
it "should raise a BadRequest when the key pair already exists" do
|
||||
lambda {
|
||||
ec2.create_key_pair('fog_key_pair')
|
||||
AWS[:ec2].create_key_pair('fog_key_pair')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ describe 'EC2.create_security_group' do
|
|||
describe 'success' do
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_security_group('fog_security_group')
|
||||
AWS[:ec2].delete_security_group('fog_security_group')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
actual = AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
@ -17,16 +17,16 @@ describe 'EC2.create_security_group' do
|
|||
describe 'failure' do
|
||||
|
||||
before(:each) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_security_group('fog_security_group')
|
||||
AWS[:ec2].delete_security_group('fog_security_group')
|
||||
end
|
||||
|
||||
it "should raise a BadRequest error when the security group already exists" do
|
||||
lambda {
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,18 +4,18 @@ describe 'EC2.create_snapshot' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
eventually do
|
||||
ec2.delete_snapshot(@snapshot_id)
|
||||
AWS[:ec2].delete_snapshot(@snapshot_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.create_snapshot(@volume_id)
|
||||
actual = AWS[:ec2].create_snapshot(@volume_id)
|
||||
actual.body['progress'].should be_a(String)
|
||||
@snapshot_id = actual.body['snapshotId']
|
||||
actual.body['snapshotId'].should be_a(String)
|
||||
|
@ -29,7 +29,7 @@ describe 'EC2.create_snapshot' do
|
|||
|
||||
it "should raise a BadRequest error if the volume does not exist" do
|
||||
lambda {
|
||||
ec2.create_snapshot('vol-00000000')
|
||||
AWS[:ec2].create_snapshot('vol-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ describe 'EC2.create_volume' do
|
|||
describe 'success' do
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.create_volume('us-east-1a', 1)
|
||||
actual = AWS[:ec2].create_volume('us-east-1a', 1)
|
||||
actual.body['availabilityZone'].should be_a(String)
|
||||
actual.body['createTime'].should be_a(Time)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
|
|
|
@ -4,8 +4,8 @@ describe 'EC2.delete_key_pair' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
ec2.create_key_pair('fog_key_name')
|
||||
@response = ec2.delete_key_pair('fog_key_name')
|
||||
AWS[:ec2].create_key_pair('fog_key_name')
|
||||
@response = AWS[:ec2].delete_key_pair('fog_key_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
|
@ -14,7 +14,7 @@ describe 'EC2.delete_key_pair' do
|
|||
end
|
||||
|
||||
it "should not raise an error if the key pair does not exist" do
|
||||
ec2.delete_key_pair('not_a_key_name')
|
||||
AWS[:ec2].delete_key_pair('not_a_key_name')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,11 +4,11 @@ describe 'EC2.delete_security_group' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.delete_security_group('fog_security_group')
|
||||
actual = AWS[:ec2].delete_security_group('fog_security_group')
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ describe 'EC2.delete_security_group' do
|
|||
|
||||
it "should raise a BadRequest error if the security group does not exist" do
|
||||
lambda {
|
||||
ec2.delete_security_group('fog_not_a_security_group')
|
||||
AWS[:ec2].delete_security_group('fog_not_a_security_group')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,17 +4,17 @@ describe 'EC2.delete_snapshot' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@snapshot_id = ec2.create_snapshot(@volume_id).body['snapshotId']
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
@snapshot_id = AWS[:ec2].create_snapshot(@volume_id).body['snapshotId']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
eventually do
|
||||
actual = ec2.delete_snapshot(@snapshot_id)
|
||||
actual = AWS[:ec2].delete_snapshot(@snapshot_id)
|
||||
unless actual.body.empty?
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
|
@ -27,7 +27,7 @@ describe 'EC2.delete_snapshot' do
|
|||
|
||||
it "should raise a BadRequest error if snapshot does not exist" do
|
||||
lambda {
|
||||
ec2.release_address('snap-00000000')
|
||||
AWS[:ec2].release_address('snap-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ describe 'EC2.create_volume' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.delete_volume(@volume_id)
|
||||
actual = AWS[:ec2].delete_volume(@volume_id)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['return'].should == true
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ describe 'EC2.create_volume' do
|
|||
|
||||
it "should raise a BadRequest error if volume does not exist" do
|
||||
lambda {
|
||||
ec2.delete_volume('vol-00000000')
|
||||
AWS[:ec2].delete_volume('vol-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,22 +4,22 @@ describe 'EC2.describe_addresses' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.release_address(@public_ip)
|
||||
AWS[:ec2].release_address(@public_ip)
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_addresses
|
||||
actual = AWS[:ec2].describe_addresses
|
||||
actual.body['requestId'].should be_a(String)
|
||||
item = actual.body['addressesSet'].select {|address| address['publicIp'] == @public_ip}
|
||||
item.should_not be_nil
|
||||
end
|
||||
|
||||
it "should return proper attributes for specific ip" do
|
||||
actual = ec2.describe_addresses(@public_ip)
|
||||
actual = AWS[:ec2].describe_addresses(@public_ip)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
item = actual.body['addressesSet'].select {|address| address['publicIp'] == @public_ip}
|
||||
item.should_not be_nil
|
||||
|
@ -30,7 +30,7 @@ describe 'EC2.describe_addresses' do
|
|||
|
||||
it "should raise a BadRequest error if ip does not exist" do
|
||||
lambda {
|
||||
ec2.describe_addresses('127.0.0.1')
|
||||
AWS[:ec2].describe_addresses('127.0.0.1')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'EC2.describe_availability_zones' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_availability_zones
|
||||
actual = AWS[:ec2].describe_availability_zones
|
||||
zone = actual.body['availabilityZoneInfo'].first
|
||||
zone['regionName'].should be_a(String)
|
||||
zone['zoneName'].should be_a(String)
|
||||
|
@ -12,7 +12,7 @@ describe 'EC2.describe_availability_zones' do
|
|||
end
|
||||
|
||||
it "should return proper attribute with params" do
|
||||
actual = ec2.describe_availability_zones(['us-east-1a'])
|
||||
actual = AWS[:ec2].describe_availability_zones(['us-east-1a'])
|
||||
zone = actual.body['availabilityZoneInfo'].first
|
||||
zone['regionName'].should be_a(String)
|
||||
zone['zoneName'].should be_a(String)
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'EC2.describe_images' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_images
|
||||
actual = AWS[:ec2].describe_images
|
||||
actual.body['requestId'].should be_a(String)
|
||||
image = actual.body['imagesSet'].first
|
||||
image['architecture'].should be_a(String)
|
||||
|
@ -20,7 +20,7 @@ describe 'EC2.describe_images' do
|
|||
end
|
||||
|
||||
it "should return proper attributes with params" do
|
||||
actual = ec2.describe_images('ImageId' => GENTOO_AMI)
|
||||
actual = AWS[:ec2].describe_images('ImageId' => GENTOO_AMI)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
image = actual.body['imagesSet'].first
|
||||
image['architecture'].should be_a(String)
|
||||
|
|
|
@ -4,17 +4,17 @@ describe 'EC2.describe_instances' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
run_instances = ec2.run_instances(GENTOO_AMI, 1, 1).body
|
||||
run_instances = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body
|
||||
@instance_id = run_instances['instancesSet'].first['instanceId']
|
||||
@reservation_id = run_instances['reservationId']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.terminate_instances([@instance_id])
|
||||
AWS[:ec2].terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_instances
|
||||
actual = AWS[:ec2].describe_instances
|
||||
reservation = actual.body['reservationSet'].select {|reservation| reservation['reservationId'] == @reservation_id}.first
|
||||
reservation['groupSet'].should be_an(Array)
|
||||
reservation['groupSet'].first.should be_a(String)
|
||||
|
@ -44,7 +44,7 @@ describe 'EC2.describe_instances' do
|
|||
end
|
||||
|
||||
it "should return proper attributes with params" do
|
||||
actual = ec2.describe_instances(@instance_id)
|
||||
actual = AWS[:ec2].describe_instances(@instance_id)
|
||||
reservation = actual.body['reservationSet'].select {|reservation| reservation['reservationId'] == @reservation_id}.first
|
||||
reservation['groupSet'].should be_an(Array)
|
||||
reservation['groupSet'].first.should be_a(String)
|
||||
|
@ -78,7 +78,7 @@ describe 'EC2.describe_instances' do
|
|||
|
||||
it 'should raise a BadRequest error if the instance does not exist' do
|
||||
lambda {
|
||||
ec2.describe_instances('i-00000000')
|
||||
AWS[:ec2].describe_instances('i-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'EC2.describe_key_pairs' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
ec2.create_key_pair('fog_key_name')
|
||||
AWS[:ec2].create_key_pair('fog_key_name')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_key_pair('fog_key_name')
|
||||
AWS[:ec2].delete_key_pair('fog_key_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_key_pairs
|
||||
actual = AWS[:ec2].describe_key_pairs
|
||||
actual.body['keySet'].should be_an(Array)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
key_pair = actual.body['keySet'].select {|key| key['keyName'] == 'fog_key_name' }.first
|
||||
|
@ -21,7 +21,7 @@ describe 'EC2.describe_key_pairs' do
|
|||
end
|
||||
|
||||
it "should return proper attributes with params" do
|
||||
actual = ec2.describe_key_pairs('fog_key_name')
|
||||
actual = AWS[:ec2].describe_key_pairs('fog_key_name')
|
||||
actual.body['keySet'].should be_an(Array)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
key_pair = actual.body['keySet'].select {|key| key['keyName'] == 'fog_key_name' }.first
|
||||
|
@ -34,7 +34,7 @@ describe 'EC2.describe_key_pairs' do
|
|||
|
||||
it "should raise a BadRequest error if the key does not exist" do
|
||||
lambda {
|
||||
ec2.describe_key_pairs('fog_not_a_key_name')
|
||||
AWS[:ec2].describe_key_pairs('fog_not_a_key_name')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@ describe 'EC2.describe_availability_zones' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_regions
|
||||
actual = AWS[:ec2].describe_regions
|
||||
zone = actual.body['regionInfo'].first
|
||||
zone['regionEndpoint'].should be_a(String)
|
||||
zone['regionName'].should be_a(String)
|
||||
end
|
||||
|
||||
it "should return proper attribute with params" do
|
||||
actual = ec2.describe_regions(['us-east-1'])
|
||||
actual = AWS[:ec2].describe_regions(['us-east-1'])
|
||||
zone = actual.body['regionInfo'].first
|
||||
zone['regionEndpoint'].should be_a(String)
|
||||
zone['regionName'].should be_a(String)
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'EC2.describe_security_groups' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_security_group('fog_security_group')
|
||||
AWS[:ec2].delete_security_group('fog_security_group')
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_security_groups
|
||||
actual = AWS[:ec2].describe_security_groups
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['securityGroupInfo'].should be_an(Array)
|
||||
security_group = actual.body['securityGroupInfo'].select do |security_group|
|
||||
|
@ -26,7 +26,7 @@ describe 'EC2.describe_security_groups' do
|
|||
end
|
||||
|
||||
it "should return proper attributes with params" do
|
||||
actual = ec2.describe_security_groups('fog_security_group')
|
||||
actual = AWS[:ec2].describe_security_groups('fog_security_group')
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['securityGroupInfo'].should be_an(Array)
|
||||
security_group = actual.body['securityGroupInfo'].select do |security_group|
|
||||
|
@ -43,7 +43,7 @@ describe 'EC2.describe_security_groups' do
|
|||
|
||||
it "should raise a BadRequest error if the security group does not exist" do
|
||||
lambda {
|
||||
ec2.describe_security_groups('not_a_security_group')
|
||||
AWS[:ec2].describe_security_groups('not_a_security_group')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,20 +4,20 @@ describe 'EC2.describe_snapshots' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@snapshot_id = ec2.create_snapshot(@volume_id).body['snapshotId']
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
@snapshot_id = AWS[:ec2].create_snapshot(@volume_id).body['snapshotId']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
eventually do
|
||||
ec2.delete_snapshot(@snapshot_id)
|
||||
AWS[:ec2].delete_snapshot(@snapshot_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
eventually do
|
||||
actual = ec2.describe_snapshots
|
||||
actual = AWS[:ec2].describe_snapshots
|
||||
actual.body['snapshotSet'].should be_an(Array)
|
||||
snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first
|
||||
snapshot['progress'].should be_a(String)
|
||||
|
@ -30,7 +30,7 @@ describe 'EC2.describe_snapshots' do
|
|||
|
||||
it "should return proper attributes with params" do
|
||||
eventually do
|
||||
actual = ec2.describe_snapshots([@snapshot_id])
|
||||
actual = AWS[:ec2].describe_snapshots([@snapshot_id])
|
||||
actual.body['snapshotSet'].should be_an(Array)
|
||||
snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first
|
||||
snapshot['progress'].should be_a(String)
|
||||
|
@ -46,7 +46,7 @@ describe 'EC2.describe_snapshots' do
|
|||
|
||||
it "should raise a BadRequest error if the snapshot does not exist" do
|
||||
lambda {
|
||||
ec2.describe_snapshots('snap-00000000')
|
||||
AWS[:ec2].describe_snapshots('snap-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'EC2.describe_volumes' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_volumes
|
||||
actual = AWS[:ec2].describe_volumes
|
||||
actual.body['requestId'].should be_a(String)
|
||||
volume = actual.body['volumeSet'].select {|volume| volume['volumeId'] == @volume_id}.first
|
||||
volume['availabilityZone'].should be_a(String)
|
||||
|
@ -25,7 +25,7 @@ describe 'EC2.describe_volumes' do
|
|||
end
|
||||
|
||||
it "should return proper attributes for specific volume" do
|
||||
actual = ec2.describe_volumes(@volume_id)
|
||||
actual = AWS[:ec2].describe_volumes(@volume_id)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
volume = actual.body['volumeSet'].select {|volume| volume['volumeId'] == @volume_id}.first
|
||||
volume['availabilityZone'].should be_a(String)
|
||||
|
@ -42,7 +42,7 @@ describe 'EC2.describe_volumes' do
|
|||
|
||||
it "should raise a BadRequest error if volume does not exist" do
|
||||
lambda {
|
||||
ec2.describe_volumes('vol-00000000')
|
||||
AWS[:ec2].describe_volumes('vol-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,23 +4,23 @@ describe 'EC2.detach_volume' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
||||
@volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
|
||||
eventually(128) do
|
||||
ec2.attach_volume(@instance_id, @volume_id, '/dev/sdh')
|
||||
AWS[:ec2].attach_volume(@instance_id, @volume_id, '/dev/sdh')
|
||||
end
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
eventually do
|
||||
ec2.delete_volume(@volume_id)
|
||||
ec2.terminate_instances([@instance_id])
|
||||
AWS[:ec2].delete_volume(@volume_id)
|
||||
AWS[:ec2].terminate_instances([@instance_id])
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
eventually do
|
||||
actual = ec2.detach_volume(@volume_id)
|
||||
actual = AWS[:ec2].detach_volume(@volume_id)
|
||||
actual.body['attachTime'].should be_a(Time)
|
||||
actual.body['device'].should be_a(String)
|
||||
actual.body['instanceId'].should be_a(String)
|
||||
|
@ -35,7 +35,7 @@ describe 'EC2.detach_volume' do
|
|||
|
||||
it "should raise a BadRequest error if the volume does not exist" do
|
||||
lambda {
|
||||
ec2.detach_volume('vol-00000000')
|
||||
AWS[:ec2].detach_volume('vol-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,18 +4,18 @@ describe 'EC2.disassociate_address' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
ec2.associate_address(@instance_id, @public_ip)
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
||||
AWS[:ec2].associate_address(@instance_id, @public_ip)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.release_address(@public_ip)
|
||||
ec2.terminate_instances([@instance_id])
|
||||
AWS[:ec2].release_address(@public_ip)
|
||||
AWS[:ec2].terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.disassociate_address(@public_ip)
|
||||
actual = AWS[:ec2].disassociate_address(@public_ip)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ describe 'EC2.disassociate_address' do
|
|||
|
||||
it "should raise a BadRequest error if the address does not exist" do
|
||||
lambda {
|
||||
ec2.disassociate_address('127.0.0.1')
|
||||
AWS[:ec2].disassociate_address('127.0.0.1')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'EC2.get_console_output' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.terminate_instances([@instance_id])
|
||||
AWS[:ec2].terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.get_console_output(@instance_id)
|
||||
actual = AWS[:ec2].get_console_output(@instance_id)
|
||||
actual.body['instanceId'].should be_a(String)
|
||||
actual.body['output'].should be_a(String)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
|
@ -24,7 +24,7 @@ describe 'EC2.get_console_output' do
|
|||
|
||||
it "should raise a BadRequest error if the instance does not exist" do
|
||||
lambda {
|
||||
ec2.get_console_output('i-00000000')
|
||||
AWS[:ec2].get_console_output('i-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'EC2.reboot_instances' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.terminate_instances(@instance_id)
|
||||
AWS[:ec2].terminate_instances(@instance_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.reboot_instances(@instance_id)
|
||||
actual = AWS[:ec2].reboot_instances(@instance_id)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ describe 'EC2.reboot_instances' do
|
|||
|
||||
it "should raise a BadRequest error if the instance does not exist" do
|
||||
lambda {
|
||||
ec2.reboot_instances('i-00000000')
|
||||
AWS[:ec2].reboot_instances('i-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ describe 'EC2.release_address' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.release_address(@public_ip)
|
||||
actual = AWS[:ec2].release_address(@public_ip)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['return'].should == true
|
||||
end
|
||||
|
@ -18,7 +18,7 @@ describe 'EC2.release_address' do
|
|||
|
||||
it "should raise a BadRequest error if address does not exist" do
|
||||
lambda {
|
||||
ec2.release_address('127.0.0.1')
|
||||
AWS[:ec2].release_address('127.0.0.1')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ describe 'EC2.revoke_security_group_ingress' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
ec2.authorize_security_group_ingress({
|
||||
AWS[:ec2].create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
AWS[:ec2].authorize_security_group_ingress({
|
||||
'FromPort' => 80,
|
||||
'GroupName' => 'fog_security_group',
|
||||
'IpProtocol' => 'tcp',
|
||||
|
@ -14,11 +14,11 @@ describe 'EC2.revoke_security_group_ingress' do
|
|||
end
|
||||
|
||||
after(:each) do
|
||||
ec2.delete_security_group('fog_security_group')
|
||||
AWS[:ec2].delete_security_group('fog_security_group')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.revoke_security_group_ingress({
|
||||
actual = AWS[:ec2].revoke_security_group_ingress({
|
||||
'FromPort' => 80,
|
||||
'GroupName' => 'fog_security_group',
|
||||
'IpProtocol' => 'tcp',
|
||||
|
|
|
@ -4,12 +4,12 @@ describe 'EC2.run_instances' do
|
|||
describe 'success' do
|
||||
|
||||
after(:each) do
|
||||
ec2.terminate_instances(@instance_id)
|
||||
AWS[:ec2].terminate_instances(@instance_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
# ami-5ee70037 = gentoo
|
||||
actual = ec2.run_instances(GENTOO_AMI, 1, 1)
|
||||
actual = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1)
|
||||
@instance_id = actual.body['instancesSet'].first['instanceId']
|
||||
actual.body['groupSet'].should be_an(Array)
|
||||
actual.body['groupSet'].first.should be_a(String)
|
||||
|
|
|
@ -4,11 +4,11 @@ describe 'EC2.terminate_instances' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.terminate_instances(@instance_id)
|
||||
actual = AWS[:ec2].terminate_instances(@instance_id)
|
||||
actual.body['requestId'].should be_a(String)
|
||||
actual.body['instancesSet'].should be_an(Array)
|
||||
instance = actual.body['instancesSet'].select {|instance| instance['instanceId'] == @instance_id}.first
|
||||
|
@ -27,7 +27,7 @@ describe 'EC2.terminate_instances' do
|
|||
|
||||
it 'should raise a BadRequest error if the instance does not exist' do
|
||||
lambda {
|
||||
ec2.terminate_instances('i-00000000')
|
||||
AWS[:ec2].terminate_instances('i-00000000')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,20 +4,20 @@ describe 'S3.copy_object' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
s3.put_bucket('fogcopyobjectsource')
|
||||
s3.put_object('fogcopyobjectsource', 'fog_copy_object_source', lorem_file)
|
||||
s3.put_bucket('fogcopyobjectdestination')
|
||||
AWS[:s3].put_bucket('fogcopyobjectsource')
|
||||
AWS[:s3].put_object('fogcopyobjectsource', 'fog_copy_object_source', lorem_file)
|
||||
AWS[:s3].put_bucket('fogcopyobjectdestination')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
s3.delete_object('fogcopyobjectdestination', 'fog_copy_object_destination')
|
||||
s3.delete_bucket('fogcopyobjectdestination')
|
||||
s3.delete_object('fogcopyobjectsource', 'fog_copy_object_source')
|
||||
s3.delete_bucket('fogcopyobjectsource')
|
||||
AWS[:s3].delete_object('fogcopyobjectdestination', 'fog_copy_object_destination')
|
||||
AWS[:s3].delete_bucket('fogcopyobjectdestination')
|
||||
AWS[:s3].delete_object('fogcopyobjectsource', 'fog_copy_object_source')
|
||||
AWS[:s3].delete_bucket('fogcopyobjectsource')
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = s3.copy_object(
|
||||
actual = AWS[:s3].copy_object(
|
||||
'fogcopyobjectsource', 'fog_copy_object_source',
|
||||
'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
|
||||
lambda {
|
||||
s3.copy_object(
|
||||
AWS[:s3].copy_object(
|
||||
'fognotabucket', 'fog_copy_object_source',
|
||||
'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
|
||||
lambda {
|
||||
s3.copy_object(
|
||||
AWS[:s3].copy_object(
|
||||
'fogcopyobjectsource', 'fog_not_an_object',
|
||||
'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
|
||||
lambda {
|
||||
s3.copy_object(
|
||||
AWS[:s3].copy_object(
|
||||
'fogcopyobjectsource', 'fog_copy_object_source',
|
||||
'fognotabucket', 'fog_copy_object_destination'
|
||||
)
|
||||
|
|
|
@ -4,11 +4,11 @@ describe 'S3.delete_bucket' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
s3.put_bucket('fogdeletebucket')
|
||||
AWS[:s3].put_bucket('fogdeletebucket')
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = s3.delete_bucket('fogdeletebucket')
|
||||
actual = AWS[:s3].delete_bucket('fogdeletebucket')
|
||||
actual.status.should == 204
|
||||
end
|
||||
|
||||
|
@ -17,18 +17,18 @@ describe 'S3.delete_bucket' do
|
|||
|
||||
it 'should raise a NotFound error if the bucket does not exist' do
|
||||
lambda {
|
||||
s3.delete_bucket('fognotabucket')
|
||||
AWS[:s3].delete_bucket('fognotabucket')
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
it 'should raise a Conflict error if the bucket is not empty' do
|
||||
s3.put_bucket('fogdeletebucket')
|
||||
s3.put_object('fogdeletebucket', 'fog_delete_object', lorem_file)
|
||||
AWS[:s3].put_bucket('fogdeletebucket')
|
||||
AWS[:s3].put_object('fogdeletebucket', 'fog_delete_object', lorem_file)
|
||||
lambda {
|
||||
s3.delete_bucket('fogdeletebucket')
|
||||
AWS[:s3].delete_bucket('fogdeletebucket')
|
||||
}.should raise_error(Excon::Errors::Conflict)
|
||||
s3.delete_object('fogdeletebucket', 'fog_delete_object')
|
||||
s3.delete_bucket('fogdeletebucket')
|
||||
AWS[:s3].delete_object('fogdeletebucket', 'fog_delete_object')
|
||||
AWS[:s3].delete_bucket('fogdeletebucket')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,16 +4,16 @@ describe 'S3.delete_object' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
s3.put_bucket('fogdeleteobject')
|
||||
s3.put_object('fogdeleteobject', 'fog_delete_object', lorem_file)
|
||||
AWS[:s3].put_bucket('fogdeleteobject')
|
||||
AWS[:s3].put_object('fogdeleteobject', 'fog_delete_object', lorem_file)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
s3.delete_bucket('fogdeleteobject')
|
||||
AWS[:s3].delete_bucket('fogdeleteobject')
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = s3.delete_object('fogdeleteobject', 'fog_delete_object')
|
||||
actual = AWS[:s3].delete_object('fogdeleteobject', 'fog_delete_object')
|
||||
actual.status.should == 204
|
||||
end
|
||||
|
||||
|
@ -22,14 +22,14 @@ describe 'S3.delete_object' do
|
|||
|
||||
it 'should raise a NotFound error if the bucket does not exist' do
|
||||
lambda {
|
||||
s3.delete_object('fognotabucket', 'fog_delete_object')
|
||||
AWS[:s3].delete_object('fognotabucket', 'fog_delete_object')
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
it 'should not raise an error if the object does not exist' do
|
||||
s3.put_bucket('fogdeleteobject')
|
||||
s3.delete_object('fogdeleteobject', 'fog_not_an_object')
|
||||
s3.delete_bucket('fogdeleteobject')
|
||||
AWS[:s3].put_bucket('fogdeleteobject')
|
||||
AWS[:s3].delete_object('fogdeleteobject', 'fog_not_an_object')
|
||||
AWS[:s3].delete_bucket('fogdeleteobject')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'S3.get_bucket_location' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
s3.put_bucket('foggetlocation', 'LocationConstraint' => 'EU')
|
||||
AWS[:s3].put_bucket('foggetlocation', 'LocationConstraint' => 'EU')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
eu_s3.delete_bucket('foggetlocation')
|
||||
AWS[:eu_s3].delete_bucket('foggetlocation')
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = s3.get_bucket_location('foggetlocation')
|
||||
actual = AWS[:s3].get_bucket_location('foggetlocation')
|
||||
actual.status.should == 200
|
||||
actual.body['LocationConstraint'].should == 'EU'
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ describe 'S3.get_bucket_location' do
|
|||
|
||||
it 'should raise NotFound error if bucket does not exist' do
|
||||
lambda {
|
||||
s3.get_bucket_location('fognotabucket')
|
||||
AWS[:s3].get_bucket_location('fognotabucket')
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,19 +4,19 @@ describe 'S3.get_bucket' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
s3.put_bucket('foggetbucket')
|
||||
s3.put_object('foggetbucket', 'fog_object', lorem_file)
|
||||
s3.put_object('foggetbucket', 'fog_other_object', lorem_file)
|
||||
AWS[:s3].put_bucket('foggetbucket')
|
||||
AWS[:s3].put_object('foggetbucket', 'fog_object', lorem_file)
|
||||
AWS[:s3].put_object('foggetbucket', 'fog_other_object', lorem_file)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
s3.delete_object('foggetbucket', 'fog_object')
|
||||
s3.delete_object('foggetbucket', 'fog_other_object')
|
||||
s3.delete_bucket('foggetbucket')
|
||||
AWS[:s3].delete_object('foggetbucket', 'fog_object')
|
||||
AWS[:s3].delete_object('foggetbucket', 'fog_other_object')
|
||||
AWS[:s3].delete_bucket('foggetbucket')
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = s3.get_bucket('foggetbucket')
|
||||
actual = AWS[:s3].get_bucket('foggetbucket')
|
||||
actual.body['IsTruncated'].should == false
|
||||
actual.body['Marker'].should be_a(String)
|
||||
actual.body['MaxKeys'].should be_an(Integer)
|
||||
|
@ -36,7 +36,7 @@ describe 'S3.get_bucket' do
|
|||
end
|
||||
|
||||
it 'should accept marker option' do
|
||||
actual = s3.get_bucket('foggetbucket', 'marker' => 'fog_object')
|
||||
actual = AWS[:s3].get_bucket('foggetbucket', 'marker' => 'fog_object')
|
||||
actual.body['IsTruncated'].should == false
|
||||
actual.body['Marker'].should be_a(String)
|
||||
actual.body['MaxKeys'].should be_an(Integer)
|
||||
|
@ -56,7 +56,7 @@ describe 'S3.get_bucket' do
|
|||
end
|
||||
|
||||
it 'should respect max-keys option' do
|
||||
actual = s3.get_bucket('foggetbucket', 'max-keys' => 1)
|
||||
actual = AWS[:s3].get_bucket('foggetbucket', 'max-keys' => 1)
|
||||
actual.body['IsTruncated'].should == true
|
||||
actual.body['Marker'].should be_a(String)
|
||||
actual.body['MaxKeys'].should be_an(Integer)
|
||||
|
@ -76,7 +76,7 @@ describe 'S3.get_bucket' do
|
|||
end
|
||||
|
||||
it 'should accept prefix option' do
|
||||
actual = s3.get_bucket('foggetbucket', 'prefix' => 'fog_ob')
|
||||
actual = AWS[:s3].get_bucket('foggetbucket', 'prefix' => 'fog_ob')
|
||||
actual.body['IsTruncated'].should == false
|
||||
actual.body['Marker'].should be_a(String)
|
||||
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
|
||||
lambda {
|
||||
s3.get_bucket('fognotabucket')
|
||||
AWS[:s3].get_bucket('fognotabucket')
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
it 'should request non-subdomain buckets and raise a NotFound error' do
|
||||
lambda {
|
||||
s3.get_bucket('A-invalid--name')
|
||||
AWS[:s3].get_bucket('A-invalid--name')
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,17 +4,17 @@ describe 'S3.get_object' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
s3.put_bucket('foggetobject')
|
||||
s3.put_object('foggetobject', 'fog_get_object', lorem_file)
|
||||
AWS[:s3].put_bucket('foggetobject')
|
||||
AWS[:s3].put_object('foggetobject', 'fog_get_object', lorem_file)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
s3.delete_object('foggetobject', 'fog_get_object')
|
||||
s3.delete_bucket('foggetobject')
|
||||
AWS[:s3].delete_object('foggetobject', 'fog_get_object')
|
||||
AWS[:s3].delete_bucket('foggetobject')
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = s3.get_object('foggetobject', 'fog_get_object')
|
||||
actual = AWS[:s3].get_object('foggetobject', 'fog_get_object')
|
||||
actual.status.should == 200
|
||||
data = lorem_file.read
|
||||
actual.body.should == data
|
||||
|
@ -26,14 +26,14 @@ describe 'S3.get_object' do
|
|||
|
||||
it 'should return chunks with optional block' do
|
||||
data = ''
|
||||
s3.get_object('foggetobject', 'fog_get_object') do |chunk|
|
||||
AWS[:s3].get_object('foggetobject', 'fog_get_object') do |chunk|
|
||||
data << chunk
|
||||
end
|
||||
data.should == lorem_file.read
|
||||
end
|
||||
|
||||
it 'should return a signed expiring url' do
|
||||
url = s3.get_object_url('foggetobject', 'fog_get_object', Time.now + 60 * 10)
|
||||
url = AWS[:s3].get_object_url('foggetobject', 'fog_get_object', Time.now + 60 * 10)
|
||||
unless Fog.mocking?
|
||||
open(url).read.should == lorem_file.read
|
||||
end
|
||||
|
@ -44,13 +44,13 @@ describe 'S3.get_object' do
|
|||
|
||||
it 'should raise a NotFound error if the bucket does not exist' do
|
||||
lambda {
|
||||
s3.get_object('fognotabucket', 'fog_get_object')
|
||||
AWS[:s3].get_object('fognotabucket', 'fog_get_object')
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
it 'should raise a NotFound error if the object does not exist' do
|
||||
lambda {
|
||||
s3.get_object('foggetobject', 'fog_not_an_object')
|
||||
AWS[:s3].get_object('foggetobject', 'fog_not_an_object')
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'S3.get_request_payment' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
s3.put_bucket('foggetrequestpayment')
|
||||
AWS[:s3].put_bucket('foggetrequestpayment')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
s3.delete_bucket('foggetrequestpayment')
|
||||
AWS[:s3].delete_bucket('foggetrequestpayment')
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = s3.get_request_payment('foggetrequestpayment')
|
||||
actual = AWS[:s3].get_request_payment('foggetrequestpayment')
|
||||
actual.status.should == 200
|
||||
actual.body['Payer'].should == 'BucketOwner'
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ describe 'S3.get_request_payment' do
|
|||
|
||||
it 'should raise a NotFound error if the bucket does not exist' do
|
||||
lambda {
|
||||
s3.get_request_payment('fognotabucket')
|
||||
AWS[:s3].get_request_payment('fognotabucket')
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'S3.get_service' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
s3.put_bucket('foggetservice')
|
||||
AWS[:s3].put_bucket('foggetservice')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
s3.delete_bucket('foggetservice')
|
||||
AWS[:s3].delete_bucket('foggetservice')
|
||||
end
|
||||
|
||||
it 'should return proper_attributes' do
|
||||
actual = s3.get_service
|
||||
actual = AWS[:s3].get_service
|
||||
actual.body['Buckets'].should be_an(Array)
|
||||
bucket = actual.body['Buckets'].select {|bucket| bucket['Name'] == 'foggetservice'}.first
|
||||
bucket['CreationDate'].should be_a(Time)
|
||||
|
@ -24,7 +24,7 @@ describe 'S3.get_service' do
|
|||
|
||||
it 'should include foggetservice in get_service' do
|
||||
eventually do
|
||||
actual = s3.get_service
|
||||
actual = AWS[:s3].get_service
|
||||
actual.body['Buckets'].collect { |bucket| bucket['Name'] }.should include('foggetservice')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,17 +4,17 @@ describe 'S3.head_object' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
s3.put_bucket('fogheadobject')
|
||||
s3.put_object('fogheadobject', 'fog_head_object', lorem_file)
|
||||
AWS[:s3].put_bucket('fogheadobject')
|
||||
AWS[:s3].put_object('fogheadobject', 'fog_head_object', lorem_file)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
s3.delete_object('fogheadobject', 'fog_head_object')
|
||||
s3.delete_bucket('fogheadobject')
|
||||
AWS[:s3].delete_object('fogheadobject', 'fog_head_object')
|
||||
AWS[:s3].delete_bucket('fogheadobject')
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = s3.head_object('fogheadobject', 'fog_head_object')
|
||||
actual = AWS[:s3].head_object('fogheadobject', 'fog_head_object')
|
||||
actual.status.should == 200
|
||||
data = lorem_file.read
|
||||
actual.headers['Content-Length'].should == data.length.to_s
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'S3.put_bucket' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
@response = s3.put_bucket('fogputbucket')
|
||||
@response = AWS[:s3].put_bucket('fogputbucket')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
s3.delete_bucket('fogputbucket')
|
||||
AWS[:s3].delete_bucket('fogputbucket')
|
||||
end
|
||||
|
||||
it 'should not raise an error if the bucket already exists' do
|
||||
s3.put_bucket('fogputbucket')
|
||||
AWS[:s3].put_bucket('fogputbucket')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,13 +4,13 @@ describe 'S3.put_object' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
s3.put_bucket('fogputobject')
|
||||
@response = s3.put_object('fogputobject', 'fog_put_object', lorem_file)
|
||||
AWS[:s3].put_bucket('fogputobject')
|
||||
@response = AWS[:s3].put_object('fogputobject', 'fog_put_object', lorem_file)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
s3.delete_object('fogputobject', 'fog_put_object')
|
||||
s3.delete_bucket('fogputobject')
|
||||
AWS[:s3].delete_object('fogputobject', 'fog_put_object')
|
||||
AWS[:s3].delete_bucket('fogputobject')
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
|
@ -18,7 +18,7 @@ describe 'S3.put_object' do
|
|||
end
|
||||
|
||||
it 'should not raise an error if the object already exists' do
|
||||
actual = s3.put_object('fogputobject', 'fog_put_object', lorem_file)
|
||||
actual = AWS[:s3].put_object('fogputobject', 'fog_put_object', lorem_file)
|
||||
actual.status.should == 200
|
||||
end
|
||||
|
||||
|
@ -27,16 +27,16 @@ describe 'S3.put_object' do
|
|||
|
||||
it 'should raise a NotFound error if the bucket does not exist' do
|
||||
lambda {
|
||||
s3.put_object('fognotabucket', 'fog_put_object', lorem_file)
|
||||
AWS[:s3].put_object('fognotabucket', 'fog_put_object', lorem_file)
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
it 'should not raise an error if the object already exists' do
|
||||
s3.put_bucket('fogputobject')
|
||||
s3.put_object('fogputobject', 'fog_put_object', lorem_file)
|
||||
s3.put_object('fogputobject', 'fog_put_object', lorem_file)
|
||||
s3.delete_object('fogputobject', 'fog_put_object')
|
||||
s3.delete_bucket('fogputobject')
|
||||
AWS[:s3].put_bucket('fogputobject')
|
||||
AWS[:s3].put_object('fogputobject', 'fog_put_object', lorem_file)
|
||||
AWS[:s3].put_object('fogputobject', 'fog_put_object', lorem_file)
|
||||
AWS[:s3].delete_object('fogputobject', 'fog_put_object')
|
||||
AWS[:s3].delete_bucket('fogputobject')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'S3.put_request_payment' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
s3.put_bucket('fogputrequestpayment')
|
||||
AWS[:s3].put_bucket('fogputrequestpayment')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
s3.delete_bucket('fogputrequestpayment')
|
||||
AWS[:s3].delete_bucket('fogputrequestpayment')
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = s3.put_request_payment('fogputrequestpayment', 'Requester')
|
||||
actual = AWS[:s3].put_request_payment('fogputrequestpayment', 'Requester')
|
||||
actual.status.should == 200
|
||||
end
|
||||
|
||||
|
@ -21,7 +21,7 @@ describe 'S3.put_request_payment' do
|
|||
|
||||
it 'should raise a NotFound error if bucket does not exist' do
|
||||
lambda {
|
||||
s3.put_request_payment('fognotabucket', 'Requester')
|
||||
AWS[:s3].put_request_payment('fognotabucket', 'Requester')
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -5,15 +5,15 @@ describe 'SimpleDB.batch_put_attributes' do
|
|||
|
||||
before(:all) do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
AWS[:sdb].delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = sdb.batch_put_attributes(@domain_name, { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
|
||||
actual = AWS[:sdb].batch_put_attributes(@domain_name, { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
|
||||
actual.body['RequestId'].should be_a(String)
|
||||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
@ -23,7 +23,7 @@ describe 'SimpleDB.batch_put_attributes' do
|
|||
|
||||
it 'should raise a BadRequest error if the domain does not exist' do
|
||||
lambda {
|
||||
sdb.batch_put_attributes('notadomain', { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
|
||||
AWS[:sdb].batch_put_attributes('notadomain', { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@ describe 'SimpleDB.create_domain' do
|
|||
end
|
||||
|
||||
after(:each) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
AWS[:sdb].delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
describe 'success' do
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = sdb.create_domain(@domain_name)
|
||||
actual = AWS[:sdb].create_domain(@domain_name)
|
||||
actual.body['RequestId'].should be_a(String)
|
||||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
@ -21,8 +21,8 @@ describe 'SimpleDB.create_domain' do
|
|||
describe 'failure' do
|
||||
|
||||
it 'should not raise an error if the domain already exists' do
|
||||
sdb.create_domain(@domain_name)
|
||||
sdb.create_domain(@domain_name)
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,16 +5,16 @@ describe 'SimpleDB.delete_attributes' do
|
|||
|
||||
before(:each) do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
sdb.put_attributes(@domain_name, 'foo', { :bar => :baz })
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
AWS[:sdb].put_attributes(@domain_name, 'foo', { :bar => :baz })
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
AWS[:sdb].delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should return proper attributes from delete_attributes' do
|
||||
actual = sdb.delete_attributes(@domain_name, 'foo')
|
||||
actual = AWS[:sdb].delete_attributes(@domain_name, 'foo')
|
||||
actual.body['RequestId'].should be_a(String)
|
||||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
@ -24,15 +24,15 @@ describe 'SimpleDB.delete_attributes' do
|
|||
|
||||
it 'shouild raise a BadRequest error if the domain does not exist' do
|
||||
lambda {
|
||||
sdb.delete_attributes('notadomain', 'notanattribute')
|
||||
AWS[:sdb].delete_attributes('notadomain', 'notanattribute')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
it 'should not raise an error if the attribute does not exist' do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
sdb.delete_attributes(@domain_name, 'notanattribute')
|
||||
sdb.delete_domain(@domain_name)
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
AWS[:sdb].delete_attributes(@domain_name, 'notanattribute')
|
||||
AWS[:sdb].delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -8,11 +8,11 @@ describe 'SimpleDB.delete_domain' do
|
|||
end
|
||||
|
||||
before(:each) do
|
||||
sdb.create_domain(@domain_name)
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = sdb.delete_domain(@domain_name)
|
||||
actual = AWS[:sdb].delete_domain(@domain_name)
|
||||
actual.body['RequestId'].should be_a(String)
|
||||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
@ -21,7 +21,7 @@ describe 'SimpleDB.delete_domain' do
|
|||
describe 'failure' do
|
||||
|
||||
it 'should not raise an error if the domain does not exist' do
|
||||
sdb.delete_domain('notadomain')
|
||||
AWS[:sdb].delete_domain('notadomain')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,15 +5,15 @@ describe 'SimpleDB.domain_metadata' do
|
|||
|
||||
before(:each) do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
AWS[:sdb].delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should return proper attributes when there are no items' do
|
||||
results = sdb.domain_metadata(@domain_name)
|
||||
results = AWS[:sdb].domain_metadata(@domain_name)
|
||||
results.body['AttributeNameCount'].should == 0
|
||||
results.body['AttributeNamesSizeBytes'].should == 0
|
||||
results.body['AttributeValueCount'].should == 0
|
||||
|
@ -26,8 +26,8 @@ describe 'SimpleDB.domain_metadata' do
|
|||
end
|
||||
|
||||
it 'should return proper attributes with items' do
|
||||
sdb.put_attributes(@domain_name, 'foo', { :bar => :baz })
|
||||
results = sdb.domain_metadata(@domain_name)
|
||||
AWS[:sdb].put_attributes(@domain_name, 'foo', { :bar => :baz })
|
||||
results = AWS[:sdb].domain_metadata(@domain_name)
|
||||
results.body['AttributeNameCount'].should == 1
|
||||
results.body['AttributeNamesSizeBytes'].should == 3
|
||||
results.body['AttributeValueCount'].should == 1
|
||||
|
@ -44,7 +44,7 @@ describe 'SimpleDB.domain_metadata' do
|
|||
|
||||
it 'should raise a BadRequest error if the domain does not exist' do
|
||||
lambda {
|
||||
sdb.domain_metadata('notadomain')
|
||||
AWS[:sdb].domain_metadata('notadomain')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -5,24 +5,24 @@ describe 'SimpleDB.get_attributes' do
|
|||
|
||||
before(:each) do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
AWS[:sdb].delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should have no attributes for foo before put_attributes' do
|
||||
eventually do
|
||||
actual = sdb.get_attributes(@domain_name, 'foo')
|
||||
actual = AWS[:sdb].get_attributes(@domain_name, 'foo')
|
||||
actual.body['Attributes'].should be_empty
|
||||
end
|
||||
end
|
||||
|
||||
it 'should have attributes for foo after put_attributes' do
|
||||
sdb.put_attributes(@domain_name, 'foo', { :bar => :baz })
|
||||
AWS[:sdb].put_attributes(@domain_name, 'foo', { :bar => :baz })
|
||||
eventually do
|
||||
actual = sdb.get_attributes(@domain_name, 'foo')
|
||||
actual = AWS[:sdb].get_attributes(@domain_name, 'foo')
|
||||
actual.body['Attributes'].should == { 'bar' => ['baz'] }
|
||||
end
|
||||
end
|
||||
|
@ -32,15 +32,15 @@ describe 'SimpleDB.get_attributes' do
|
|||
|
||||
it 'should raise a BadRequest error if the domain does not exist' do
|
||||
lambda {
|
||||
sdb.get_attributes('notadomain', 'notanattribute')
|
||||
AWS[:sdb].get_attributes('notadomain', 'notanattribute')
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
it 'should not raise an error if the attribute does not exist' do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
sdb.get_attributes(@domain_name, 'notanattribute')
|
||||
sdb.delete_domain(@domain_name)
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
AWS[:sdb].get_attributes(@domain_name, 'notanattribute')
|
||||
AWS[:sdb].delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -8,20 +8,20 @@ describe 'SimpleDB.list_domains' do
|
|||
end
|
||||
|
||||
after(:each) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
AWS[:sdb].delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
results = sdb.list_domains
|
||||
results = AWS[:sdb].list_domains
|
||||
results.body['BoxUsage'].should be_a(Float)
|
||||
results.body['Domains'].should be_an(Array)
|
||||
results.body['RequestId'].should be_a(String)
|
||||
end
|
||||
|
||||
it 'should include created domains' do
|
||||
sdb.create_domain(@domain_name)
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
eventually do
|
||||
actual = sdb.list_domains
|
||||
actual = AWS[:sdb].list_domains
|
||||
actual.body['Domains'].should include(@domain_name)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,15 +5,15 @@ describe 'SimpleDB.put_attributes' do
|
|||
|
||||
before(:each) do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
AWS[:sdb].create_domain(@domain_name)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
AWS[:sdb].delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
it 'should return proper attributes from put_attributes' do
|
||||
actual = sdb.put_attributes(@domain_name, 'foo', { 'bar' => 'baz' })
|
||||
actual = AWS[:sdb].put_attributes(@domain_name, 'foo', { 'bar' => 'baz' })
|
||||
actual.body['RequestId'].should be_a(String)
|
||||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
@ -23,7 +23,7 @@ describe 'SimpleDB.put_attributes' do
|
|||
|
||||
it 'should raise a BadRequest error if the domain does not exist' do
|
||||
lambda {
|
||||
sdb.put_attributes(@domain_name, 'notadomain', { 'notanattribute' => 'value' })
|
||||
AWS[:sdb].put_attributes(@domain_name, 'notadomain', { 'notanattribute' => 'value' })
|
||||
}.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ describe 'Fog::AWS::EC2::Server' do
|
|||
subject { @server = @servers.new(:flavor_id => 1, :image_id => 3, :name => 'name') }
|
||||
|
||||
before(:each) do
|
||||
@servers = servers.servers
|
||||
@servers = Rackspace[:servers].servers
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
|
|
|
@ -4,11 +4,11 @@ describe 'Rackspace::Files.delete_container' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
files.put_container('container_name')
|
||||
Rackspace[:files].put_container('container_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
files.delete_container('container_name')
|
||||
Rackspace[:files].delete_container('container_name')
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -16,7 +16,7 @@ describe 'Rackspace::Files.delete_container' do
|
|||
|
||||
it "should raise a NotFound error if the container does not exist" do
|
||||
lambda do
|
||||
files.delete_container('container_name')
|
||||
Rackspace[:files].delete_container('container_name')
|
||||
end.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,16 +4,16 @@ describe 'Rackspace::Files.delete_object' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
files.put_container('container_name')
|
||||
files.put_object('container_name', 'object_name', lorem_file)
|
||||
Rackspace[:files].put_container('container_name')
|
||||
Rackspace[:files].put_object('container_name', 'object_name', lorem_file)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
files.delete_container('container_name')
|
||||
Rackspace[:files].delete_container('container_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
files.delete_object('container_name', 'object_name')
|
||||
Rackspace[:files].delete_object('container_name', 'object_name')
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -21,16 +21,16 @@ describe 'Rackspace::Files.delete_object' do
|
|||
|
||||
it "should raise a NotFound error if the container does not exist" do
|
||||
lambda do
|
||||
files.delete_object('container_name', 'object_name')
|
||||
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
|
||||
files.put_container('container_name')
|
||||
Rackspace[:files].put_container('container_name')
|
||||
lambda do
|
||||
files.delete_object('container_name', 'object_name')
|
||||
Rackspace[:files].delete_object('container_name', 'object_name')
|
||||
end.should raise_error(Excon::Errors::NotFound)
|
||||
files.delete_container('container_name')
|
||||
Rackspace[:files].delete_container('container_name')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,17 +4,17 @@ describe 'Rackspace::Files.get_container' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
files.put_container('container_name')
|
||||
files.put_object('container_name', 'object_name', lorem_file)
|
||||
Rackspace[:files].put_container('container_name')
|
||||
Rackspace[:files].put_object('container_name', 'object_name', lorem_file)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
files.delete_object('container_name', 'object_name')
|
||||
files.delete_container('container_name')
|
||||
Rackspace[:files].delete_object('container_name', 'object_name')
|
||||
Rackspace[:files].delete_container('container_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = files.get_container('container_name').body
|
||||
actual = Rackspace[:files].get_container('container_name').body
|
||||
actual.first['bytes'].should be_an(Integer)
|
||||
actual.first['content_type'].should be_a(String)
|
||||
actual.first['hash'].should be_a(String)
|
||||
|
@ -26,7 +26,7 @@ describe 'Rackspace::Files.get_container' do
|
|||
describe 'failure' do
|
||||
|
||||
it "should not raise an if the container does not exist" do
|
||||
files.get_container('container_name')
|
||||
Rackspace[:files].get_container('container_name')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'Rackspace::Files.get_containers' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
files.put_container('container_name')
|
||||
Rackspace[:files].put_container('container_name')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
files.delete_container('container_name')
|
||||
Rackspace[:files].delete_container('container_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = files.get_containers.body
|
||||
actual = Rackspace[:files].get_containers.body
|
||||
actual.first['bytes'].should be_an(Integer)
|
||||
actual.first['count'].should be_an(Integer)
|
||||
actual.first['name'].should be_a(String)
|
||||
|
|
|
@ -4,17 +4,17 @@ describe 'Rackspace::Files.head_container' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
files.put_container('container_name')
|
||||
files.put_object('container_name', 'object_name', lorem_file)
|
||||
Rackspace[:files].put_container('container_name')
|
||||
Rackspace[:files].put_object('container_name', 'object_name', lorem_file)
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
files.delete_object('container_name', 'object_name')
|
||||
files.delete_container('container_name')
|
||||
Rackspace[:files].delete_object('container_name', 'object_name')
|
||||
Rackspace[:files].delete_container('container_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
files.head_container('container_name')
|
||||
Rackspace[:files].head_container('container_name')
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -22,7 +22,7 @@ describe 'Rackspace::Files.head_container' do
|
|||
|
||||
it "should raise a NotFound error if the container does not exist" do
|
||||
lambda do
|
||||
files.head_container('container_name')
|
||||
Rackspace[:files].head_container('container_name')
|
||||
end.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@ describe 'Rackspace::Files.head_containers' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
files.put_container('container_name')
|
||||
Rackspace[:files].put_container('container_name')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
files.delete_container('container_name')
|
||||
Rackspace[:files].delete_container('container_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
files.head_containers
|
||||
Rackspace[:files].head_containers
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,11 +4,11 @@ describe 'Rackspace::Files.put_container' do
|
|||
describe 'success' do
|
||||
|
||||
after(:each) do
|
||||
files.delete_container('container_name')
|
||||
Rackspace[:files].delete_container('container_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
files.put_container('container_name')
|
||||
Rackspace[:files].put_container('container_name')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -4,16 +4,16 @@ describe 'Rackspace::Files.put_object' do
|
|||
describe 'success' do
|
||||
|
||||
before(:each) do
|
||||
files.put_container('container_name')
|
||||
Rackspace[:files].put_container('container_name')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
files.delete_object('container_name', 'object_name')
|
||||
files.delete_container('container_name')
|
||||
Rackspace[:files].delete_object('container_name', 'object_name')
|
||||
Rackspace[:files].delete_container('container_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
files.put_object('container_name', 'object_name', lorem_file)
|
||||
Rackspace[:files].put_object('container_name', 'object_name', lorem_file)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,18 +5,18 @@ describe 'Rackspace::Servers.create_image' do
|
|||
|
||||
before(:each) do
|
||||
# flavor 1 = 256, image 3 = gentoo 2008.0
|
||||
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'name').body['server']['id']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
eventually(128) do
|
||||
servers.delete_server(@server_id)
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
servers.delete_image(@image_id)
|
||||
Rackspace[:servers].delete_image(@image_id)
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.create_image(@server_id).body['image']
|
||||
actual = Rackspace[:servers].create_image(@server_id).body['image']
|
||||
@image_id = actual['id']
|
||||
actual['id'].should be_an(Integer)
|
||||
actual['serverId'].should be_an(Integer)
|
||||
|
|
|
@ -5,13 +5,13 @@ describe 'Rackspace::Servers.create_server' do
|
|||
|
||||
after(:each) do
|
||||
eventually(128) do
|
||||
servers.delete_server(@server_id)
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
# flavor 1 = 256, image 3 = gentoo 2008.0
|
||||
actual = servers.create_server(1, 3, 'name').body['server']
|
||||
actual = Rackspace[:servers].create_server(1, 3, 'name').body['server']
|
||||
@server_id = actual['id']
|
||||
actual['addresses'].should be_a(Hash)
|
||||
actual['addresses']['private'].should be_an(Array)
|
||||
|
|
|
@ -5,19 +5,19 @@ describe 'Rackspace::Servers.delete_image' do
|
|||
|
||||
before(:each) do
|
||||
# flavor 1 = 256, image 3 = gentoo 2008.0
|
||||
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
||||
@image_id = servers.create_image(@server_id).body['image']['id']
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'name').body['server']['id']
|
||||
@image_id = Rackspace[:servers].create_image(@server_id).body['image']['id']
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
eventually(128) do
|
||||
servers.delete_server(@server_id)
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
eventually(128) do
|
||||
servers.delete_image(@image_id)
|
||||
Rackspace[:servers].delete_image(@image_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,7 +26,7 @@ describe 'Rackspace::Servers.delete_image' do
|
|||
|
||||
it "should raise a BadRequest error if the image does not exist" do
|
||||
lambda do
|
||||
servers.delete_image(0)
|
||||
Rackspace[:servers].delete_image(0)
|
||||
end.should raise_error(Excon::Errors::BadRequest)
|
||||
end
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ describe 'Rackspace::Servers.delete_server' do
|
|||
|
||||
before(:each) do
|
||||
# flavor 1 = 256, image 3 = gentoo 2008.0
|
||||
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'name').body['server']['id']
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
eventually(128) do
|
||||
servers.delete_server(@server_id)
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -19,7 +19,7 @@ describe 'Rackspace::Servers.delete_server' do
|
|||
|
||||
it "should raise a NotFound error if the server does not exist" do
|
||||
lambda {
|
||||
servers.delete_server(0)
|
||||
Rackspace[:servers].delete_server(0)
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Rackspace::Servers.get_flavor_details' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.get_flavor_details(1).body['flavor']
|
||||
actual = Rackspace[:servers].get_flavor_details(1).body['flavor']
|
||||
actual['disk'].should be_an(Integer)
|
||||
actual['id'].should be_an(Integer)
|
||||
actual['name'].should be_a(String)
|
||||
|
|
|
@ -5,17 +5,17 @@ describe 'Rackspace::Servers.get_server_details' do
|
|||
|
||||
before(:each) do
|
||||
# flavor 1 = 256, image 3 = gentoo 2008.0
|
||||
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'name').body['server']['id']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
eventually(128) do
|
||||
servers.delete_server(@server_id)
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.get_server_details(@server_id).body['server']
|
||||
actual = Rackspace[:servers].get_server_details(@server_id).body['server']
|
||||
actual['addresses'].should be_a(Hash)
|
||||
actual['addresses']['private'].should be_an(Array)
|
||||
actual['addresses']['private'].first.should be_a(String)
|
||||
|
@ -36,7 +36,7 @@ describe 'Rackspace::Servers.get_server_details' do
|
|||
|
||||
it "should raise a NotFound error if the server does not exist" do
|
||||
lambda {
|
||||
servers.get_server_details(0)
|
||||
Rackspace[:servers].get_server_details(0)
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -5,17 +5,17 @@ describe 'Rackspace::Servers.list_addresses' do
|
|||
|
||||
before(:each) do
|
||||
# flavor 1 = 256, image 3 = gentoo 2008.0
|
||||
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'name').body['server']['id']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
eventually(128) do
|
||||
servers.delete_server(@server_id)
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_addresses(@server_id).body
|
||||
actual = Rackspace[:servers].list_addresses(@server_id).body
|
||||
actual['addresses'].should be_a(Hash)
|
||||
actual['addresses']['private'].should be_an(Array)
|
||||
actual['addresses']['public'].should be_an(Array)
|
||||
|
@ -26,7 +26,7 @@ describe 'Rackspace::Servers.list_addresses' do
|
|||
|
||||
it "should raise a NotFound error if the server does not exist" do
|
||||
lambda {
|
||||
servers.list_addresses(0)
|
||||
Rackspace[:servers].list_addresses(0)
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Rackspace::Servers.list_flavors_detail' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_flavors_detail.body
|
||||
actual = Rackspace[:servers].list_flavors_detail.body
|
||||
actual['flavors'].should be_an(Array)
|
||||
flavor = actual['flavors'].first
|
||||
flavor['disk'].should be_an(Integer)
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Rackspace::Servers.list_flavors' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_flavors.body
|
||||
actual = Rackspace[:servers].list_flavors.body
|
||||
actual['flavors'].should be_an(Array)
|
||||
flavor = actual['flavors'].first
|
||||
flavor['id'].should be_an(Integer)
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Rackspace::Servers.list_images_detail' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_images_detail.body
|
||||
actual = Rackspace[:servers].list_images_detail.body
|
||||
actual['images'].should be_an(Array)
|
||||
image = actual['images'].first
|
||||
image['created'].should be_a(String)
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Rackspace::Servers.list_images' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_images.body
|
||||
actual = Rackspace[:servers].list_images.body
|
||||
actual['images'].should be_an(Array)
|
||||
image = actual['images'].first
|
||||
image['id'].should be_an(Integer)
|
||||
|
|
|
@ -5,17 +5,17 @@ describe 'Rackspace::Servers.list_private_addresses' do
|
|||
|
||||
before(:each) do
|
||||
# flavor 1 = 256, image 3 = gentoo 2008.0
|
||||
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'name').body['server']['id']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
eventually(128) do
|
||||
servers.delete_server(@server_id)
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_private_addresses(@server_id).body
|
||||
actual = Rackspace[:servers].list_private_addresses(@server_id).body
|
||||
actual['private'].should be_an(Array)
|
||||
end
|
||||
|
||||
|
@ -24,7 +24,7 @@ describe 'Rackspace::Servers.list_private_addresses' do
|
|||
|
||||
it "should raise a NotFound error if the server does not exist" do
|
||||
lambda {
|
||||
servers.list_private_addresses(0)
|
||||
Rackspace[:servers].list_private_addresses(0)
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -5,17 +5,17 @@ describe 'Rackspace::Servers.list_public_addresses' do
|
|||
|
||||
before(:each) do
|
||||
# flavor 1 = 256, image 3 = gentoo 2008.0
|
||||
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'name').body['server']['id']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
eventually(128) do
|
||||
servers.delete_server(@server_id)
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_public_addresses(@server_id).body
|
||||
actual = Rackspace[:servers].list_public_addresses(@server_id).body
|
||||
actual['public'].should be_an(Array)
|
||||
end
|
||||
|
||||
|
@ -24,7 +24,7 @@ describe 'Rackspace::Servers.list_public_addresses' do
|
|||
|
||||
it "should raise a NotFound error if the server does not exist" do
|
||||
lambda {
|
||||
servers.list_public_addresses(0)
|
||||
Rackspace[:servers].list_public_addresses(0)
|
||||
}.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -5,17 +5,17 @@ describe 'Rackspace::Servers.list_servers_detail' do
|
|||
|
||||
before(:each) do
|
||||
# flavor 1 = 256, image 3 = gentoo 2008.0
|
||||
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'name').body['server']['id']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
eventually(128) do
|
||||
servers.delete_server(@server_id)
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_servers_detail.body['servers'].first
|
||||
actual = Rackspace[:servers].list_servers_detail.body['servers'].first
|
||||
actual['addresses'].should be_a(Hash)
|
||||
actual['addresses']['private'].should be_an(Array)
|
||||
actual['addresses']['private'].first.should be_a(String)
|
||||
|
|
|
@ -5,17 +5,17 @@ describe 'Rackspace::Servers.list_servers' do
|
|||
|
||||
before(:each) do
|
||||
# flavor 1 = 256, image 3 = gentoo 2008.0
|
||||
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'name').body['server']['id']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
eventually(128) do
|
||||
servers.delete_server(@server_id)
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_servers.body['servers'].first
|
||||
actual = Rackspace[:servers].list_servers.body['servers'].first
|
||||
actual['id'].should be_an(Integer)
|
||||
actual['name'].should be_a(String)
|
||||
end
|
||||
|
|
|
@ -5,17 +5,17 @@ describe 'Rackspace::Servers.reboot_server' do
|
|||
|
||||
before(:each) do
|
||||
# flavor 1 = 256, image 3 = gentoo 2008.0
|
||||
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'name').body['server']['id']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
eventually(128) do
|
||||
servers.delete_server(@server_id)
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
servers.reboot_server(@server_id, 'HARD')
|
||||
Rackspace[:servers].reboot_server(@server_id, 'HARD')
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -23,7 +23,7 @@ describe 'Rackspace::Servers.reboot_server' do
|
|||
|
||||
it "should raise a NotFound error if the server does not exist" do
|
||||
lambda do
|
||||
servers.reboot_server(0, 'HARD')
|
||||
Rackspace[:servers].reboot_server(0, 'HARD')
|
||||
end.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -5,18 +5,18 @@ describe 'Rackspace::Servers.update_server' do
|
|||
|
||||
before(:each) do
|
||||
# flavor 1 = 256, image 3 = gentoo 2008.0
|
||||
@server_id = servers.create_server(1, 3, 'name').body['server']['id']
|
||||
@server_id = Rackspace[:servers].create_server(1, 3, 'name').body['server']['id']
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
eventually(128) do
|
||||
servers.delete_server(@server_id)
|
||||
Rackspace[:servers].delete_server(@server_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
eventually(128) do
|
||||
servers.update_server(@server_id, :name => 'server_name', :adminPass => 'admin_password')
|
||||
Rackspace[:servers].update_server(@server_id, :name => 'server_name', :adminPass => 'admin_password')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -25,7 +25,7 @@ describe 'Rackspace::Servers.update_server' do
|
|||
|
||||
it "should raise a NotFound error if the server does not exist" do
|
||||
lambda do
|
||||
servers.update_server(0, :name => 'server_name', :adminPass => 'admin_password')
|
||||
Rackspace[:servers].update_server(0, :name => 'server_name', :adminPass => 'admin_password')
|
||||
end.should raise_error(Excon::Errors::NotFound)
|
||||
end
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@ describe 'Slicehost.create_slice' do
|
|||
|
||||
after(:each) do
|
||||
eventually(128) do
|
||||
slicehost.delete_slice(@slice_id)
|
||||
Slicehost[:slices].delete_slice(@slice_id)
|
||||
end
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
# flavor_id 1: 256 ram, image_id 3: Gentoo 2008.0
|
||||
actual = slicehost.create_slice(1, 3, 'fog_create_slice').body
|
||||
actual = Slicehost[:slices].create_slice(1, 3, 'fog_create_slice').body
|
||||
actual['addresses'].should be_a(Array)
|
||||
# actual['backup-id'].should be_an(Integer)
|
||||
actual['bw-in'].should be_an(Float)
|
||||
|
|
|
@ -5,12 +5,12 @@ describe 'Slicehost.delete_slice' do
|
|||
|
||||
before(:each) do
|
||||
# flavor_id 1: 256 ram, image_id 3: Gentoo 2008.0
|
||||
@slice_id = slicehost.create_slice(1, 3, 'fog_delete_slice').body['id']
|
||||
@slice_id = Slicehost[:slices].create_slice(1, 3, 'fog_delete_slice').body['id']
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
eventually(128) do
|
||||
actual = slicehost.delete_slice(@slice_id)
|
||||
actual = Slicehost[:slices].delete_slice(@slice_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Slicehost.get_backups' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = slicehost.get_backups.body
|
||||
actual = Slicehost[:slices].get_backups.body
|
||||
actual['backups'].should be_an(Array)
|
||||
backup = actual['backups'].first
|
||||
# backup['date'].should be_a(String)
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Slicehost.get_flavors' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = slicehost.get_flavors.body
|
||||
actual = Slicehost[:slices].get_flavors.body
|
||||
actual['flavors'].should be_an(Array)
|
||||
flavor = actual['flavors'].first
|
||||
flavor['id'].should be_an(Integer)
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Slicehost.get_images' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = slicehost.get_images.body
|
||||
actual = Slicehost[:slices].get_images.body
|
||||
actual['images'].should be_an(Array)
|
||||
image = actual['images'].first
|
||||
image['id'].should be_an(Integer)
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Slicehost.get_slices' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = slicehost.get_slices.body
|
||||
actual = Slicehost[:slices].get_slices.body
|
||||
actual['slices'].should be_an(Array)
|
||||
slice = actual['slices'].first
|
||||
# slice['addresses'].should be_a(Array)
|
||||
|
|
|
@ -11,54 +11,68 @@ Spec::Runner.options.parse_format("Spec::Runner::Formatter::CompactProgressBarFo
|
|||
Spec::Runner.options.loadby = 'mtime'
|
||||
Spec::Runner.options.reverse = true
|
||||
|
||||
def ec2
|
||||
Fog::AWS::EC2.new(
|
||||
:aws_access_key_id => Fog.credentials[:aws_access_key_id],
|
||||
:aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
|
||||
)
|
||||
|
||||
|
||||
module AWS
|
||||
class << self
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials[:default].reject do |k, v|
|
||||
![:aws_access_key_id, :aws_secret_access_key].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :ec2
|
||||
Fog::AWS::EC2.new(credentials)
|
||||
when :eu_s3
|
||||
Fog::AWS::S3.new(credentials.merge!(:host => 's3-external-3.amazonaws.com'))
|
||||
when :sdb
|
||||
Fog::AWS::SimpleDB.new(credentials)
|
||||
when :s3
|
||||
Fog::AWS::S3.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def eu_s3
|
||||
Fog::AWS::S3.new(
|
||||
:aws_access_key_id => Fog.credentials[:aws_access_key_id],
|
||||
:aws_secret_access_key => Fog.credentials[:aws_secret_access_key],
|
||||
:host => 's3-external-3.amazonaws.com'
|
||||
)
|
||||
module Rackspace
|
||||
class << self
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials[:default].reject do |k, v|
|
||||
![:rackspace_api_key, :rackspace_username].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :files
|
||||
Fog::Rackspace::Files.new(credentials)
|
||||
when :servers
|
||||
Fog::Rackspace::Servers.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def files
|
||||
Fog::Rackspace::Files.new(
|
||||
:rackspace_api_key => Fog.credentials[:rackspace_api_key],
|
||||
:rackspace_username => Fog.credentials[:rackspace_username]
|
||||
)
|
||||
module Slicehost
|
||||
class << self
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials[:default].reject do |k, v|
|
||||
![:slicehost_password].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :slices
|
||||
Fog::Slicehost.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def sdb
|
||||
Fog::AWS::SimpleDB.new(
|
||||
:aws_access_key_id => Fog.credentials[:aws_access_key_id],
|
||||
:aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
|
||||
)
|
||||
end
|
||||
|
||||
def s3
|
||||
Fog::AWS::S3.new(
|
||||
:aws_access_key_id => Fog.credentials[:aws_access_key_id],
|
||||
:aws_secret_access_key => Fog.credentials[:aws_secret_access_key]
|
||||
)
|
||||
end
|
||||
|
||||
def servers
|
||||
Fog::Rackspace::Servers.new(
|
||||
:rackspace_api_key => Fog.credentials[:rackspace_api_key],
|
||||
:rackspace_username => Fog.credentials[:rackspace_username]
|
||||
)
|
||||
end
|
||||
|
||||
def slicehost
|
||||
Fog::Slicehost.new(
|
||||
:password => Fog.credentials[:slicehost_password]
|
||||
)
|
||||
end
|
||||
|
||||
def eventually(max_delay = 16, &block)
|
||||
delays = [0]
|
||||
|
|
Загрузка…
Ссылка в новой задаче