mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
cleanup/decouple specs
This commit is contained in:
parent
5cdb40d261
commit
09e9315be9
50 changed files with 791 additions and 700 deletions
|
@ -1,9 +1,9 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.allocate_address' do
|
||||
describe 'success'
|
||||
describe 'success' do
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.release_address(@public_ip)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.associate_address' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.release_address(@public_ip)
|
||||
ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
|
@ -18,4 +19,5 @@ describe 'EC2.associate_address' do
|
|||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,13 +1,14 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.attach_volume' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
eventually do
|
||||
ec2.detach_volume(@volume_id)
|
||||
end
|
||||
|
@ -29,4 +30,5 @@ describe 'EC2.attach_volume' do
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,12 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.authorize_security_group_ingress' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.delete_security_group('fog_security_group')
|
||||
end
|
||||
|
||||
|
@ -21,4 +22,5 @@ describe 'EC2.authorize_security_group_ingress' do
|
|||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|||
describe 'EC2.create_key_pair' do
|
||||
describe 'success' do
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.delete_key_pair('fog_key_pair')
|
||||
end
|
||||
|
||||
|
@ -18,6 +18,14 @@ describe 'EC2.create_key_pair' do
|
|||
end
|
||||
describe 'failure' do
|
||||
|
||||
before(:each) do
|
||||
ec2.create_key_pair('fog_key_pair')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
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')
|
||||
|
|
|
@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|||
describe 'EC2.create_security_group' do
|
||||
describe 'success' do
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.delete_security_group('fog_security_group')
|
||||
end
|
||||
|
||||
|
@ -16,6 +16,14 @@ describe 'EC2.create_security_group' do
|
|||
end
|
||||
describe 'failure' do
|
||||
|
||||
before(:each) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
end
|
||||
|
||||
after(:each) do
|
||||
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')
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.create_snapshot' do
|
||||
describe "success" do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
eventually do
|
||||
ec2.delete_snapshot(@snapshot_id)
|
||||
|
@ -25,7 +25,7 @@ describe 'EC2.create_snapshot' do
|
|||
end
|
||||
|
||||
end
|
||||
describe "failure" do
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the volume does not exist" do
|
||||
lambda {
|
||||
|
|
|
@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|||
describe 'EC2.create_volume' do
|
||||
describe 'success' do
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
|
|
|
@ -3,18 +3,18 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|||
describe 'EC2.delete_key_pair' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
ec2.create_key_pair('fog_key_pair')
|
||||
before(:each) do
|
||||
ec2.create_key_pair('fog_key_name')
|
||||
@response = ec2.delete_key_pair('fog_key_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = ec2.delete_key_pair('fog_key_pair')
|
||||
actual.body['requestId'].should be_a(String)
|
||||
[false, true].should include(actual.body['return'])
|
||||
@response.body['requestId'].should be_a(String)
|
||||
[false, true].should include(@response.body['return'])
|
||||
end
|
||||
|
||||
it "should not raise an error if the key pair does not exist" do
|
||||
ec2.delete_key_pair('not_a_key_pair')
|
||||
ec2.delete_key_pair('not_a_key_name')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|||
describe 'EC2.delete_security_group' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
end
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|||
describe 'EC2.delete_snapshot' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@snapshot_id = ec2.create_snapshot(@volume_id).body['snapshotId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|||
describe 'EC2.create_volume' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.describe_addresses' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.release_address(@public_ip)
|
||||
end
|
||||
|
||||
|
@ -24,10 +25,14 @@ describe 'EC2.describe_addresses' do
|
|||
item.should_not be_nil
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if ip does not exist" do
|
||||
lambda {
|
||||
ec2.describe_addresses('127.0.0.1')
|
||||
}.should raise_error(Fog::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.describe_availability_zones' do
|
||||
describe 'success' do
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_availability_zones
|
||||
|
@ -18,4 +19,5 @@ describe 'EC2.describe_availability_zones' do
|
|||
zone['zoneState'].should be_a(String)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.describe_images' do
|
||||
describe 'success' do
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_images
|
||||
|
@ -34,4 +35,5 @@ describe 'EC2.describe_images' do
|
|||
image['ramdiskId'].should be_a(String) if image['ramdiskId']
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.describe_instances' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
run_instances = ec2.run_instances('ami-5ee70037', 1, 1).body
|
||||
@instance_id = run_instances['instancesSet'].first['instanceId']
|
||||
@reservation_id = run_instances['reservationId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
|
@ -72,4 +73,5 @@ describe 'EC2.describe_instances' do
|
|||
instance['reason'].should be_a(String)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,37 +1,42 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.describe_key_pairs' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
ec2.create_key_pair('key_name')
|
||||
before(:each) do
|
||||
ec2.create_key_pair('fog_key_name')
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
ec2.delete_key_pair('key_name')
|
||||
after(:each) do
|
||||
ec2.delete_key_pair('fog_key_name')
|
||||
end
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = 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'] == 'key_name' }.first
|
||||
key_pair = actual.body['keySet'].select {|key| key['keyName'] == 'fog_key_name' }.first
|
||||
key_pair['keyFingerprint'].should be_a(String)
|
||||
key_pair['keyName'].should be_a(String)
|
||||
end
|
||||
|
||||
it "should return proper attributes with params" do
|
||||
actual = ec2.describe_key_pairs('key_name')
|
||||
actual = 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'] == 'key_name' }.first
|
||||
key_pair = actual.body['keySet'].select {|key| key['keyName'] == 'fog_key_name' }.first
|
||||
key_pair['keyFingerprint'].should be_a(String)
|
||||
key_pair['keyName'].should be_a(String)
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the key does not exist" do
|
||||
lambda {
|
||||
ec2.describe_key_pairs('not_a_key_name')
|
||||
ec2.describe_key_pairs('fog_not_a_key_name')
|
||||
}.should raise_error(Fog::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.describe_availability_zones' do
|
||||
describe 'success' do
|
||||
|
||||
it "should return proper attributes with no params" do
|
||||
actual = ec2.describe_regions
|
||||
|
@ -16,4 +17,5 @@ describe 'EC2.describe_availability_zones' do
|
|||
zone['regionName'].should be_a(String)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.describe_security_groups' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.delete_security_group('fog_security_group')
|
||||
end
|
||||
|
||||
|
@ -37,10 +38,14 @@ describe 'EC2.describe_security_groups' do
|
|||
security_group['ipPermissions'].should be_an(Array)
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the security group does not exist" do
|
||||
lambda {
|
||||
ec2.describe_security_groups('not_a_security_group')
|
||||
}.should raise_error(Fog::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.describe_snapshots' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
@snapshot_id = ec2.create_snapshot(@volume_id).body['snapshotId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
eventually do
|
||||
ec2.delete_snapshot(@snapshot_id)
|
||||
|
@ -40,10 +41,14 @@ describe 'EC2.describe_snapshots' do
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if the snapshot does not exist" do
|
||||
lambda {
|
||||
ec2.describe_snapshots('snap-00000000')
|
||||
}.should raise_error(Fog::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.describe_volumes' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.delete_volume(@volume_id)
|
||||
end
|
||||
|
||||
|
@ -36,10 +37,14 @@ describe 'EC2.describe_volumes' do
|
|||
volume['attachmentSet'].should == []
|
||||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if volume does not exist" do
|
||||
lambda {
|
||||
ec2.describe_volumes('vol-00000000')
|
||||
}.should raise_error(Fog::Errors::BadRequest)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.detach_volume' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1, {'Placement.AvailabilityZone' => 'us-east-1a'}).body['instancesSet'].first['instanceId']
|
||||
@volume_id = ec2.create_volume('us-east-1a', 1).body['volumeId']
|
||||
eventually(128) do
|
||||
|
@ -10,7 +11,7 @@ describe 'EC2.detach_volume' do
|
|||
end
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
eventually do
|
||||
ec2.delete_volume(@volume_id)
|
||||
ec2.terminate_instances([@instance_id])
|
||||
|
@ -29,4 +30,5 @@ describe 'EC2.detach_volume' do
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,14 +1,15 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.disassociate_address' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
ec2.associate_address(@instance_id, @public_ip)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.release_address(@public_ip)
|
||||
ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
|
@ -19,4 +20,5 @@ describe 'EC2.disassociate_address' do
|
|||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,12 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.get_console_output' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
|
@ -18,4 +19,5 @@ describe 'EC2.get_console_output' do
|
|||
actual.body['timestamp'].should be_a(Time)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.reboot_instances' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
|
@ -16,4 +17,5 @@ describe 'EC2.reboot_instances' do
|
|||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.release_address' do
|
||||
describe 'success'
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@public_ip = ec2.allocate_address.body['publicIp']
|
||||
end
|
||||
|
||||
|
@ -14,7 +14,7 @@ describe 'EC2.release_address' do
|
|||
end
|
||||
|
||||
end
|
||||
describe 'failure'
|
||||
describe 'failure' do
|
||||
|
||||
it "should raise a BadRequest error if address does not exist" do
|
||||
lambda {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.revoke_security_group_ingress' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
ec2.create_security_group('fog_security_group', 'a security group for testing fog')
|
||||
ec2.authorize_security_group_ingress({
|
||||
'FromPort' => 80,
|
||||
|
@ -12,7 +13,7 @@ describe 'EC2.revoke_security_group_ingress' do
|
|||
})
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.delete_security_group('fog_security_group')
|
||||
end
|
||||
|
||||
|
@ -27,4 +28,5 @@ describe 'EC2.revoke_security_group_ingress' do
|
|||
[false, true].should include(actual.body['return'])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.run_instances' do
|
||||
describe 'success' do
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
ec2.terminate_instances([@instance_id])
|
||||
end
|
||||
|
||||
|
@ -36,4 +37,5 @@ describe 'EC2.run_instances' do
|
|||
actual.body['reservationId'].should be_a(String)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'EC2.terminate_instances' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@instance_id = ec2.run_instances('ami-5ee70037', 1, 1).body['instancesSet'].first['instanceId']
|
||||
end
|
||||
|
||||
|
@ -21,4 +22,5 @@ describe 'EC2.terminate_instances' do
|
|||
shutdown_state['name'].should be_a(String)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,14 +3,14 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|||
describe 'S3.copy_object' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
s3.put_bucket('fogcopyobjectsource')
|
||||
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
||||
s3.put_object('fogcopyobjectsource', 'fog_copy_object_source', file)
|
||||
s3.put_bucket('fogcopyobjectdestination')
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
s3.delete_object('fogcopyobjectdestination', 'fog_copy_object_destination')
|
||||
s3.delete_bucket('fogcopyobjectdestination')
|
||||
s3.delete_object('fogcopyobjectsource', 'fog_copy_object_source')
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'S3.delete_bucket' do
|
||||
describe 'success'
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
s3.put_bucket('fogdeletebucket')
|
||||
end
|
||||
|
||||
|
@ -13,7 +13,7 @@ describe 'S3.delete_bucket' do
|
|||
end
|
||||
|
||||
end
|
||||
describe 'failure'
|
||||
describe 'failure' do
|
||||
|
||||
it 'should raise a NotFound error if the bucket does not exist' do
|
||||
lambda {
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'S3.delete_object' do
|
||||
describe 'success'
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
s3.put_bucket('fogdeleteobject')
|
||||
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
||||
s3.put_object('fogdeleteobject', 'fog_delete_object', file)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
s3.delete_bucket('fogdeleteobject')
|
||||
end
|
||||
|
||||
|
@ -19,16 +19,18 @@ describe 'S3.delete_object' do
|
|||
end
|
||||
|
||||
end
|
||||
describe 'failure'
|
||||
describe 'failure' do
|
||||
|
||||
it 'should raise NotFound error if the bucket does not exist' do
|
||||
it 'should raise a NotFound error if the bucket does not exist' do
|
||||
lambda {
|
||||
s3.delete_object('fognotabucket', 'fog_delete_object')
|
||||
}.should raise_error(Fog::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')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'S3.get_bucket_location' do
|
||||
describe 'success'
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
s3.put_bucket('foggetlocation', 'LocationConstraint' => 'EU')
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
eu_s3.delete_bucket('foggetlocation')
|
||||
end
|
||||
|
||||
|
@ -18,7 +18,7 @@ describe 'S3.get_bucket_location' do
|
|||
end
|
||||
|
||||
end
|
||||
describe 'failure'
|
||||
describe 'failure' do
|
||||
|
||||
it 'should raise NotFound error if bucket does not exist' do
|
||||
lambda {
|
||||
|
|
|
@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|||
describe 'S3.get_bucket' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
s3.put_bucket('foggetbucket')
|
||||
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
||||
s3.put_object('foggetbucket', 'fog_object', file)
|
||||
|
@ -11,7 +11,7 @@ describe 'S3.get_bucket' do
|
|||
s3.put_object('foggetbucket', 'fog_other_object', file)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
s3.delete_object('foggetbucket', 'fog_object')
|
||||
s3.delete_object('foggetbucket', 'fog_other_object')
|
||||
s3.delete_bucket('foggetbucket')
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'S3.get_object' do
|
||||
describe 'success'
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
s3.put_bucket('foggetobject')
|
||||
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
||||
s3.put_object('foggetobject', 'fog_get_object', file)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
s3.delete_object('foggetobject', 'fog_get_object')
|
||||
s3.delete_bucket('foggetobject')
|
||||
end
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'S3.get_request_payment' do
|
||||
describe 'success'
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
s3.put_bucket('foggetrequestpayment')
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
s3.delete_bucket('foggetrequestpayment')
|
||||
end
|
||||
|
||||
|
@ -18,7 +18,7 @@ describe 'S3.get_request_payment' do
|
|||
end
|
||||
|
||||
end
|
||||
describe 'failure'
|
||||
describe 'failure' do
|
||||
|
||||
it 'should raise a NotFound error if the bucket does not exist' do
|
||||
lambda {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'S3.get_service' do
|
||||
describe 'success'
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
s3.put_bucket('foggetservice')
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
s3.delete_bucket('foggetservice')
|
||||
end
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|||
describe 'S3.head_object' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
s3.put_bucket('fogheadobject')
|
||||
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
||||
s3.put_object('fogheadobject', 'fog_head_object', file)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
s3.delete_object('fogheadobject', 'fog_head_object')
|
||||
s3.delete_bucket('fogheadobject')
|
||||
end
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'S3.put_bucket' do
|
||||
describe 'success'
|
||||
describe 'success' do
|
||||
|
||||
after(:all) do
|
||||
s3.delete_bucket('fogputbucket')
|
||||
before(:each) do
|
||||
@response = s3.put_bucket('fogputbucket')
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
actual = s3.put_bucket('fogputbucket')
|
||||
actual.status.should == 200
|
||||
after(:each) do
|
||||
s3.delete_bucket('fogputbucket')
|
||||
end
|
||||
|
||||
it 'should not raise an error if the bucket already exists' do
|
||||
|
|
|
@ -1,28 +1,21 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'S3.put_object' do
|
||||
describe 'success'
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
s3.put_bucket('fogputobject')
|
||||
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
||||
@response = s3.put_object('fogputobject', 'fog_put_object', file)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
s3.delete_object('fogputobject', 'fog_put_object')
|
||||
s3.delete_bucket('fogputobject')
|
||||
end
|
||||
|
||||
it 'should return proper attributes' do
|
||||
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
||||
actual = s3.put_object('fogputobject', 'fog_put_object', file)
|
||||
actual.status.should == 200
|
||||
end
|
||||
|
||||
it 'should raise a NotFound error if the bucket does not exist' do
|
||||
lambda {
|
||||
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
||||
s3.put_object('fognotabucket', 'fog_put_object', file)
|
||||
}.should raise_error(Fog::Errors::NotFound)
|
||||
@response.status.should == 200
|
||||
end
|
||||
|
||||
it 'should not raise an error if the object already exists' do
|
||||
|
@ -32,4 +25,14 @@ describe 'S3.put_object' do
|
|||
end
|
||||
|
||||
end
|
||||
describe 'failure' do
|
||||
|
||||
it 'should raise a NotFound error if the bucket does not exist' do
|
||||
lambda {
|
||||
file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
||||
s3.put_object('fognotabucket', 'fog_put_object', file)
|
||||
}.should raise_error(Fog::Errors::NotFound)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'S3.put_request_payment' do
|
||||
describe 'success'
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
s3.put_bucket('fogputrequestpayment')
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
s3.delete_bucket('fogputrequestpayment')
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'SimpleDB.batch_put_attributes' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
|
@ -17,4 +18,5 @@ describe 'SimpleDB.batch_put_attributes' do
|
|||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,12 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'SimpleDB.create_domain' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
|
@ -16,4 +17,5 @@ describe 'SimpleDB.create_domain' do
|
|||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'SimpleDB.delete_attributes' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
sdb.create_domain('delete_attributes')
|
||||
sdb.put_attributes('delete_attributes', 'foo', { :bar => :baz })
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
sdb.delete_domain('delete_attributes')
|
||||
end
|
||||
|
||||
|
@ -17,4 +18,5 @@ describe 'SimpleDB.delete_attributes' do
|
|||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'SimpleDB.delete_domain' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
end
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
sdb.create_domain(@domain_name)
|
||||
end
|
||||
|
||||
|
@ -16,4 +17,5 @@ describe 'SimpleDB.delete_domain' do
|
|||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,13 +1,14 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'SimpleDB.domain_metadata' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
|
@ -38,4 +39,5 @@ describe 'SimpleDB.domain_metadata' do
|
|||
results.body['Timestamp'].should be_a(Time)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'SimpleDB.get_attributes' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
|
@ -26,4 +27,5 @@ describe 'SimpleDB.get_attributes' do
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'SimpleDB.list_domains' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
|
@ -25,4 +26,5 @@ describe 'SimpleDB.list_domains' do
|
|||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'SimpleDB.put_attributes' do
|
||||
describe 'success' do
|
||||
|
||||
before(:all) do
|
||||
before(:each) do
|
||||
@domain_name = "fog_domain_#{Time.now.to_i}"
|
||||
sdb.create_domain(@domain_name)
|
||||
end
|
||||
|
||||
after(:all) do
|
||||
after(:each) do
|
||||
sdb.delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
|
@ -17,4 +18,5 @@ describe 'SimpleDB.put_attributes' do
|
|||
actual.body['BoxUsage'].should be_a(Float)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
require File.dirname(__FILE__) + '/../../../spec_helper'
|
||||
|
||||
describe 'SimpleDB.select' do
|
||||
describe 'success' do
|
||||
|
||||
it "should have some specs"
|
||||
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue