fog 0.0.40 → 0.0.41
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -0
- data/Rakefile +12 -0
- data/VERSION +1 -1
- data/bin/fog +28 -40
- data/fog.gemspec +16 -3
- data/lib/fog.rb +27 -3
- data/lib/fog/aws/ec2.rb +7 -3
- data/lib/fog/aws/models/ec2/security_group.rb +1 -1
- data/lib/fog/aws/models/ec2/server.rb +8 -3
- data/lib/fog/aws/models/ec2/servers.rb +1 -1
- data/lib/fog/aws/parsers/ec2/terminate_instances.rb +10 -10
- data/lib/fog/aws/requests/ec2/run_instances.rb +1 -1
- data/lib/fog/aws/s3.rb +6 -2
- data/lib/fog/rackspace.rb +8 -2
- data/lib/fog/slicehost.rb +3 -1
- data/spec/aws/models/ec2/address_spec.rb +8 -8
- data/spec/aws/models/ec2/addresses_spec.rb +10 -10
- data/spec/aws/models/ec2/key_pair_spec.rb +8 -8
- data/spec/aws/models/ec2/key_pairs_spec.rb +10 -10
- data/spec/aws/models/ec2/security_group_spec.rb +8 -8
- data/spec/aws/models/ec2/security_groups_spec.rb +10 -10
- data/spec/aws/models/ec2/server_spec.rb +1 -4
- data/spec/aws/models/ec2/servers_spec.rb +1 -1
- data/spec/aws/models/ec2/snapshot_spec.rb +12 -10
- data/spec/aws/models/ec2/snapshots_spec.rb +20 -20
- data/spec/aws/models/ec2/volume_spec.rb +10 -10
- data/spec/aws/models/ec2/volumes_spec.rb +10 -10
- data/spec/aws/models/s3/directories_spec.rb +8 -8
- data/spec/aws/models/s3/directory_spec.rb +11 -11
- data/spec/aws/models/s3/file_spec.rb +2 -2
- data/spec/aws/models/s3/files_spec.rb +2 -2
- data/spec/aws/requests/ec2/allocate_address_spec.rb +2 -2
- data/spec/aws/requests/ec2/associate_address_spec.rb +15 -13
- data/spec/aws/requests/ec2/attach_volume_spec.rb +12 -12
- data/spec/aws/requests/ec2/authorize_security_group_ingress_spec.rb +3 -3
- data/spec/aws/requests/ec2/create_key_pair_spec.rb +5 -5
- data/spec/aws/requests/ec2/create_security_group_spec.rb +5 -5
- data/spec/aws/requests/ec2/create_snapshot_spec.rb +5 -5
- data/spec/aws/requests/ec2/create_volume_spec.rb +2 -2
- data/spec/aws/requests/ec2/delete_key_pair_spec.rb +3 -3
- data/spec/aws/requests/ec2/delete_security_group_spec.rb +3 -3
- data/spec/aws/requests/ec2/delete_snapshot_spec.rb +5 -5
- data/spec/aws/requests/ec2/delete_volume_spec.rb +3 -3
- data/spec/aws/requests/ec2/describe_addresses_spec.rb +5 -5
- data/spec/aws/requests/ec2/describe_availability_zones_spec.rb +2 -2
- data/spec/aws/requests/ec2/describe_images_spec.rb +2 -2
- data/spec/aws/requests/ec2/describe_instances_spec.rb +5 -5
- data/spec/aws/requests/ec2/describe_key_pairs_spec.rb +5 -5
- data/spec/aws/requests/ec2/describe_regions_spec.rb +2 -2
- data/spec/aws/requests/ec2/describe_security_groups_spec.rb +5 -5
- data/spec/aws/requests/ec2/describe_snapshots_spec.rb +7 -7
- data/spec/aws/requests/ec2/describe_volumes_spec.rb +5 -5
- data/spec/aws/requests/ec2/detach_volume_spec.rb +7 -7
- data/spec/aws/requests/ec2/disassociate_address_spec.rb +9 -7
- data/spec/aws/requests/ec2/get_console_output_spec.rb +4 -4
- data/spec/aws/requests/ec2/reboot_instances_spec.rb +4 -4
- data/spec/aws/requests/ec2/release_address_spec.rb +3 -3
- data/spec/aws/requests/ec2/revoke_security_group_ingress_spec.rb +4 -4
- data/spec/aws/requests/ec2/run_instances_spec.rb +2 -2
- data/spec/aws/requests/ec2/terminate_instances_spec.rb +7 -7
- data/spec/aws/requests/s3/copy_object_spec.rb +11 -11
- data/spec/aws/requests/s3/delete_bucket_spec.rb +8 -8
- data/spec/aws/requests/s3/delete_object_spec.rb +8 -8
- data/spec/aws/requests/s3/get_bucket_location_spec.rb +4 -4
- data/spec/aws/requests/s3/get_bucket_spec.rb +12 -12
- data/spec/aws/requests/s3/get_object_spec.rb +9 -9
- data/spec/aws/requests/s3/get_request_payment_spec.rb +4 -4
- data/spec/aws/requests/s3/get_service_spec.rb +4 -4
- data/spec/aws/requests/s3/head_object_spec.rb +5 -5
- data/spec/aws/requests/s3/put_bucket_spec.rb +3 -3
- data/spec/aws/requests/s3/put_object_spec.rb +11 -11
- data/spec/aws/requests/s3/put_request_payment_spec.rb +4 -4
- data/spec/aws/requests/simpledb/batch_put_attributes_spec.rb +4 -4
- data/spec/aws/requests/simpledb/create_domain_spec.rb +4 -4
- data/spec/aws/requests/simpledb/delete_attributes_spec.rb +8 -8
- data/spec/aws/requests/simpledb/delete_domain_spec.rb +3 -3
- data/spec/aws/requests/simpledb/domain_metadata_spec.rb +6 -6
- data/spec/aws/requests/simpledb/get_attributes_spec.rb +9 -9
- data/spec/aws/requests/simpledb/list_domains_spec.rb +4 -4
- data/spec/aws/requests/simpledb/put_attributes_spec.rb +4 -4
- data/spec/compact_progress_bar_formatter.rb +195 -0
- data/spec/rackspace/models/servers/server_spec.rb +1 -1
- data/spec/rackspace/requests/files/delete_container_spec.rb +3 -3
- data/spec/rackspace/requests/files/delete_object_spec.rb +8 -8
- data/spec/rackspace/requests/files/get_container_spec.rb +6 -6
- data/spec/rackspace/requests/files/get_containers_spec.rb +3 -3
- data/spec/rackspace/requests/files/head_container_spec.rb +6 -6
- data/spec/rackspace/requests/files/head_containers_spec.rb +3 -3
- data/spec/rackspace/requests/files/put_container_spec.rb +2 -2
- data/spec/rackspace/requests/files/put_object_spec.rb +4 -4
- data/spec/rackspace/requests/servers/create_image_spec.rb +4 -4
- data/spec/rackspace/requests/servers/create_server_spec.rb +2 -2
- data/spec/rackspace/requests/servers/delete_image_spec.rb +5 -5
- data/spec/rackspace/requests/servers/delete_server_spec.rb +3 -3
- data/spec/rackspace/requests/servers/get_flavor_details_spec.rb +1 -1
- data/spec/rackspace/requests/servers/get_server_details_spec.rb +4 -4
- data/spec/rackspace/requests/servers/list_addresses_spec.rb +4 -4
- data/spec/rackspace/requests/servers/list_flavors_detail_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_flavors_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_images_detail_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_images_spec.rb +1 -1
- data/spec/rackspace/requests/servers/list_private_addresses_spec.rb +4 -4
- data/spec/rackspace/requests/servers/list_public_addresses_spec.rb +4 -4
- data/spec/rackspace/requests/servers/list_servers_detail_spec.rb +3 -3
- data/spec/rackspace/requests/servers/list_servers_spec.rb +3 -3
- data/spec/rackspace/requests/servers/reboot_server_spec.rb +4 -4
- data/spec/rackspace/requests/servers/update_server_spec.rb +4 -4
- data/spec/slicehost/requests/create_slice_spec.rb +2 -2
- data/spec/slicehost/requests/delete_slice_spec.rb +2 -2
- data/spec/slicehost/requests/get_backups_spec.rb +1 -1
- data/spec/slicehost/requests/get_flavors_spec.rb +1 -1
- data/spec/slicehost/requests/get_images_spec.rb +1 -1
- data/spec/slicehost/requests/get_slices_spec.rb +1 -1
- data/spec/spec_helper.rb +60 -38
- metadata +16 -3
- data/spec/spec.opts +0 -1
@@ -5,25 +5,25 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
5
5
|
describe "#all" do
|
6
6
|
|
7
7
|
it "should return a Fog::AWS::EC2::Snapshots" do
|
8
|
-
ec2.snapshots.all.should be_a(Fog::AWS::EC2::Snapshots)
|
8
|
+
AWS[:ec2].snapshots.all.should be_a(Fog::AWS::EC2::Snapshots)
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should include persisted snapshots" do
|
12
|
-
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
13
|
-
snapshot = volume.snapshots.create
|
14
|
-
ec2.snapshots.all.map {|snapshot| snapshot.id}.should include(snapshot.id)
|
15
|
-
snapshot.destroy
|
16
|
-
volume.destroy
|
12
|
+
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
13
|
+
eventually { @snapshot = @volume.snapshots.create }
|
14
|
+
AWS[:ec2].snapshots.all.map {|snapshot| snapshot.id}.should include(@snapshot.id)
|
15
|
+
@snapshot.destroy
|
16
|
+
@volume.destroy
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should limit snapshots by volume if present" do
|
20
|
-
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
21
|
-
other_volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
22
|
-
snapshot = volume.snapshots.create
|
23
|
-
other_volume.snapshots.all.map {|snapshot| snapshot.id}.should_not include(snapshot.id)
|
24
|
-
snapshot.destroy
|
25
|
-
other_volume.destroy
|
26
|
-
volume.destroy
|
20
|
+
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
21
|
+
@other_volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
22
|
+
eventually { @snapshot = @volume.snapshots.create }
|
23
|
+
@other_volume.snapshots.all.map {|snapshot| snapshot.id}.should_not include(@snapshot.id)
|
24
|
+
@snapshot.destroy
|
25
|
+
@other_volume.destroy
|
26
|
+
@volume.destroy
|
27
27
|
end
|
28
28
|
|
29
29
|
end
|
@@ -31,7 +31,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
31
31
|
describe "#create" do
|
32
32
|
|
33
33
|
before(:each) do
|
34
|
-
@volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
34
|
+
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
35
35
|
@snapshot = @volume.snapshots.create
|
36
36
|
end
|
37
37
|
|
@@ -45,7 +45,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should exist on ec2" do
|
48
|
-
ec2.snapshots.get(@snapshot.id).should_not be_nil
|
48
|
+
AWS[:ec2].snapshots.get(@snapshot.id).should_not be_nil
|
49
49
|
end
|
50
50
|
|
51
51
|
end
|
@@ -53,15 +53,15 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
53
53
|
describe "#get" do
|
54
54
|
|
55
55
|
it "should return a Fog::AWS::EC2::Snapshot if a matching snapshot exists" do
|
56
|
-
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
56
|
+
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
57
57
|
snapshot = volume.snapshots.create
|
58
|
-
get = ec2.snapshots.get(snapshot.id)
|
58
|
+
get = AWS[:ec2].snapshots.get(snapshot.id)
|
59
59
|
snapshot.attributes.reject {|key, value| [:progress, :status].include?(key)}.should == get.attributes.reject {|key, value| [:progress, :status].include?(key)}
|
60
60
|
snapshot.destroy
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should return nil if no matching address exists" do
|
64
|
-
ec2.snapshots.get('vol-00000000').should be_nil
|
64
|
+
AWS[:ec2].snapshots.get('vol-00000000').should be_nil
|
65
65
|
end
|
66
66
|
|
67
67
|
end
|
@@ -69,7 +69,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
69
69
|
describe "#new" do
|
70
70
|
|
71
71
|
it "should return a Fog::AWS::EC2::Snapshot" do
|
72
|
-
ec2.snapshots.new.should be_a(Fog::AWS::EC2::Snapshot)
|
72
|
+
AWS[:ec2].snapshots.new.should be_a(Fog::AWS::EC2::Snapshot)
|
73
73
|
end
|
74
74
|
|
75
75
|
end
|
@@ -77,7 +77,7 @@ describe 'Fog::AWS::EC2::Snapshots' do
|
|
77
77
|
describe "#reload" do
|
78
78
|
|
79
79
|
it "should return a Fog::AWS::EC2::Snapshots" do
|
80
|
-
ec2.snapshots.all.reload.should be_a(Fog::AWS::EC2::Snapshots)
|
80
|
+
AWS[:ec2].snapshots.all.reload.should be_a(Fog::AWS::EC2::Snapshots)
|
81
81
|
end
|
82
82
|
|
83
83
|
end
|
@@ -5,7 +5,7 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
5
5
|
describe "#initialize" do
|
6
6
|
|
7
7
|
it "should remap attributes from parser" do
|
8
|
-
volume = ec2.volumes.new(
|
8
|
+
volume = AWS[:ec2].volumes.new(
|
9
9
|
'attachTime' => 'now',
|
10
10
|
'availabilityZone' => 'us-east-1a',
|
11
11
|
'createTime' => 'recently',
|
@@ -26,11 +26,11 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
26
26
|
describe "#collection" do
|
27
27
|
|
28
28
|
it "should return a Fog::AWS::EC2::Volumes" do
|
29
|
-
ec2.volumes.new.collection.should be_a(Fog::AWS::EC2::Volumes)
|
29
|
+
AWS[:ec2].volumes.new.collection.should be_a(Fog::AWS::EC2::Volumes)
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should be the volumes the volume is related to" do
|
33
|
-
volumes = ec2.volumes
|
33
|
+
volumes = AWS[:ec2].volumes
|
34
34
|
volumes.new.collection.should == volumes
|
35
35
|
end
|
36
36
|
|
@@ -39,7 +39,7 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
39
39
|
describe "#destroy" do
|
40
40
|
|
41
41
|
it "should return true if the volume is deleted" do
|
42
|
-
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
42
|
+
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
43
43
|
volume.destroy.should be_true
|
44
44
|
end
|
45
45
|
|
@@ -47,8 +47,8 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
47
47
|
|
48
48
|
describe "#server=" do
|
49
49
|
before(:each) do
|
50
|
-
@server = ec2.servers.create(:image_id => GENTOO_AMI)
|
51
|
-
@volume = ec2.volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
|
50
|
+
@server = AWS[:ec2].servers.create(:image_id => GENTOO_AMI)
|
51
|
+
@volume = AWS[:ec2].volumes.new(:availability_zone => @server.availability_zone, :size => 1, :device => '/dev/sdz1')
|
52
52
|
@server.wait_for { state == 'running' }
|
53
53
|
end
|
54
54
|
|
@@ -94,7 +94,7 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
94
94
|
describe "#reload" do
|
95
95
|
|
96
96
|
before(:each) do
|
97
|
-
@volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
97
|
+
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
98
98
|
@reloaded = @volume.reload
|
99
99
|
end
|
100
100
|
|
@@ -115,7 +115,7 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
115
115
|
describe "#save" do
|
116
116
|
|
117
117
|
before(:each) do
|
118
|
-
@volume = ec2.volumes.new(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
118
|
+
@volume = AWS[:ec2].volumes.new(:availability_zone => 'us-east-1a', :size => 1, :device => '/dev/sdz1')
|
119
119
|
end
|
120
120
|
|
121
121
|
it "should return true when it succeeds" do
|
@@ -124,12 +124,12 @@ describe 'Fog::AWS::EC2::Volume' do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
it "should not exist in volumes before save" do
|
127
|
-
ec2.volumes.get(@volume.id).should be_nil
|
127
|
+
AWS[:ec2].volumes.get(@volume.id).should be_nil
|
128
128
|
end
|
129
129
|
|
130
130
|
it "should exist in buckets after save" do
|
131
131
|
@volume.save
|
132
|
-
ec2.volumes.get(@volume.id).should_not be_nil
|
132
|
+
AWS[:ec2].volumes.get(@volume.id).should_not be_nil
|
133
133
|
@volume.destroy
|
134
134
|
end
|
135
135
|
|
@@ -5,12 +5,12 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|
5
5
|
describe "#all" do
|
6
6
|
|
7
7
|
it "should return a Fog::AWS::EC2::Volumes" do
|
8
|
-
ec2.volumes.all.should be_a(Fog::AWS::EC2::Volumes)
|
8
|
+
AWS[:ec2].volumes.all.should be_a(Fog::AWS::EC2::Volumes)
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should include persisted volumes" do
|
12
|
-
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
13
|
-
ec2.volumes.get(volume.id).should_not be_nil
|
12
|
+
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
13
|
+
AWS[:ec2].volumes.get(volume.id).should_not be_nil
|
14
14
|
volume.destroy
|
15
15
|
end
|
16
16
|
|
@@ -19,7 +19,7 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|
19
19
|
describe "#create" do
|
20
20
|
|
21
21
|
before(:each) do
|
22
|
-
@volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
22
|
+
@volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
23
23
|
end
|
24
24
|
|
25
25
|
after(:each) do
|
@@ -31,7 +31,7 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should exist on ec2" do
|
34
|
-
ec2.volumes.get(@volume.id).should_not be_nil
|
34
|
+
AWS[:ec2].volumes.get(@volume.id).should_not be_nil
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
@@ -39,14 +39,14 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|
39
39
|
describe "#get" do
|
40
40
|
|
41
41
|
it "should return a Fog::AWS::EC2::Volume if a matching volume exists" do
|
42
|
-
volume = ec2.volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
43
|
-
get = ec2.volumes.get(volume.id)
|
42
|
+
volume = AWS[:ec2].volumes.create(:availability_zone => 'us-east-1a', :size => 1, :device => 'dev/sdz1')
|
43
|
+
get = AWS[:ec2].volumes.get(volume.id)
|
44
44
|
volume.attributes.reject { |key, value| [:device, :status].include?(key) }.should == get.attributes.reject { |key, value| [:device, :status].include?(key) }
|
45
45
|
volume.destroy
|
46
46
|
end
|
47
47
|
|
48
48
|
it "should return nil if no matching address exists" do
|
49
|
-
ec2.volumes.get('vol-00000000').should be_nil
|
49
|
+
AWS[:ec2].volumes.get('vol-00000000').should be_nil
|
50
50
|
end
|
51
51
|
|
52
52
|
end
|
@@ -54,7 +54,7 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|
54
54
|
describe "#new" do
|
55
55
|
|
56
56
|
it "should return a Fog::AWS::EC2::Volume" do
|
57
|
-
ec2.volumes.new.should be_a(Fog::AWS::EC2::Volume)
|
57
|
+
AWS[:ec2].volumes.new.should be_a(Fog::AWS::EC2::Volume)
|
58
58
|
end
|
59
59
|
|
60
60
|
end
|
@@ -62,7 +62,7 @@ describe 'Fog::AWS::EC2::Volumes' do
|
|
62
62
|
describe "#reload" do
|
63
63
|
|
64
64
|
it "should return a Fog::AWS::EC2::Volumes" do
|
65
|
-
ec2.volumes.all.reload.should be_a(Fog::AWS::EC2::Volumes)
|
65
|
+
AWS[:ec2].volumes.all.reload.should be_a(Fog::AWS::EC2::Volumes)
|
66
66
|
end
|
67
67
|
|
68
68
|
end
|
@@ -5,8 +5,8 @@ describe 'Fog::AWS::S3::Directories' do
|
|
5
5
|
describe "#all" do
|
6
6
|
|
7
7
|
it "should include persisted directories" do
|
8
|
-
@directory = s3.directories.create(:name => 'fogdirectoryname')
|
9
|
-
s3.directories.all.map {|directory| @directory.name}.should include('fogdirectoryname')
|
8
|
+
@directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
|
9
|
+
AWS[:s3].directories.all.map {|directory| @directory.name}.should include('fogdirectoryname')
|
10
10
|
@directory.destroy
|
11
11
|
end
|
12
12
|
|
@@ -15,8 +15,8 @@ describe 'Fog::AWS::S3::Directories' do
|
|
15
15
|
describe "#create" do
|
16
16
|
|
17
17
|
it "should exist on s3" do
|
18
|
-
directory = s3.directories.create(:name => 'fogdirectoryname')
|
19
|
-
s3.directories.get(directory.name).should_not be_nil
|
18
|
+
directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
|
19
|
+
AWS[:s3].directories.get(directory.name).should_not be_nil
|
20
20
|
directory.destroy
|
21
21
|
end
|
22
22
|
|
@@ -25,14 +25,14 @@ describe 'Fog::AWS::S3::Directories' do
|
|
25
25
|
describe "#get" do
|
26
26
|
|
27
27
|
it "should return a Fog::AWS::S3::Directory if a matching directory exists" do
|
28
|
-
directory = s3.directories.create(:name => 'fogdirectoryname')
|
29
|
-
get = s3.directories.get('fogdirectoryname')
|
28
|
+
directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
|
29
|
+
get = AWS[:s3].directories.get('fogdirectoryname')
|
30
30
|
directory.attributes.should == get.attributes
|
31
31
|
directory.destroy
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should return nil if no matching directory exists" do
|
35
|
-
s3.directories.get('fogdirectoryname').should be_nil
|
35
|
+
AWS[:s3].directories.get('fogdirectoryname').should be_nil
|
36
36
|
end
|
37
37
|
|
38
38
|
end
|
@@ -40,7 +40,7 @@ describe 'Fog::AWS::S3::Directories' do
|
|
40
40
|
describe "#reload" do
|
41
41
|
|
42
42
|
it "should reload data" do
|
43
|
-
directories = s3.directories
|
43
|
+
directories = AWS[:s3].directories
|
44
44
|
directories.should == directories.reload
|
45
45
|
end
|
46
46
|
|
@@ -19,7 +19,7 @@ describe 'Fog::AWS::S3::Directory' do
|
|
19
19
|
describe "#collection" do
|
20
20
|
|
21
21
|
it "should be the directories the directory is related to" do
|
22
|
-
directories = s3.directories
|
22
|
+
directories = AWS[:s3].directories
|
23
23
|
directories.new.collection.should == directories
|
24
24
|
end
|
25
25
|
|
@@ -28,12 +28,12 @@ describe 'Fog::AWS::S3::Directory' do
|
|
28
28
|
describe "#destroy" do
|
29
29
|
|
30
30
|
it "should return true if the directory is deleted" do
|
31
|
-
directory = s3.directories.create(:name => 'fogmodeldirectory')
|
31
|
+
directory = AWS[:s3].directories.create(:name => 'fogmodeldirectory')
|
32
32
|
directory.destroy.should be_true
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should return false if the directory does not exist" do
|
36
|
-
directory = s3.directories.new(:name => 'fogmodeldirectory')
|
36
|
+
directory = AWS[:s3].directories.new(:name => 'fogmodeldirectory')
|
37
37
|
directory.destroy.should be_false
|
38
38
|
end
|
39
39
|
|
@@ -42,9 +42,9 @@ describe 'Fog::AWS::S3::Directory' do
|
|
42
42
|
describe "#location" do
|
43
43
|
|
44
44
|
it "should return the location constraint" do
|
45
|
-
directory = s3.directories.create(:name => 'fogmodeleudirectory', :location => 'EU')
|
45
|
+
directory = AWS[:s3].directories.create(:name => 'fogmodeleudirectory', :location => 'EU')
|
46
46
|
directory.location.should == 'EU'
|
47
|
-
eu_s3.directories.get('fogmodeleudirectory').destroy
|
47
|
+
AWS[:eu_s3].directories.get('fogmodeleudirectory').destroy
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
@@ -52,7 +52,7 @@ describe 'Fog::AWS::S3::Directory' do
|
|
52
52
|
describe "#payer" do
|
53
53
|
|
54
54
|
it "should return the request payment value" do
|
55
|
-
directory = s3.directories.create(:name => 'fogmodeldirectory')
|
55
|
+
directory = AWS[:s3].directories.create(:name => 'fogmodeldirectory')
|
56
56
|
directory.payer.should == 'BucketOwner'
|
57
57
|
directory.destroy.should be_true
|
58
58
|
end
|
@@ -62,7 +62,7 @@ describe 'Fog::AWS::S3::Directory' do
|
|
62
62
|
describe "#payer=" do
|
63
63
|
|
64
64
|
it "should set the request payment value" do
|
65
|
-
directory = s3.directories.create(:name => 'fogmodeldirectory')
|
65
|
+
directory = AWS[:s3].directories.create(:name => 'fogmodeldirectory')
|
66
66
|
(directory.payer = 'Requester').should == 'Requester'
|
67
67
|
directory.destroy.should
|
68
68
|
end
|
@@ -72,7 +72,7 @@ describe 'Fog::AWS::S3::Directory' do
|
|
72
72
|
describe "#reload" do
|
73
73
|
|
74
74
|
before(:each) do
|
75
|
-
@directory = s3.directories.create(:name => 'fogmodeldirectory')
|
75
|
+
@directory = AWS[:s3].directories.create(:name => 'fogmodeldirectory')
|
76
76
|
@reloaded = @directory.reload
|
77
77
|
end
|
78
78
|
|
@@ -89,7 +89,7 @@ describe 'Fog::AWS::S3::Directory' do
|
|
89
89
|
describe "#save" do
|
90
90
|
|
91
91
|
before(:each) do
|
92
|
-
@directory = s3.directories.new(:name => 'fogmodeldirectory')
|
92
|
+
@directory = AWS[:s3].directories.new(:name => 'fogmodeldirectory')
|
93
93
|
end
|
94
94
|
|
95
95
|
it "should return true when it succeeds" do
|
@@ -98,12 +98,12 @@ describe 'Fog::AWS::S3::Directory' do
|
|
98
98
|
end
|
99
99
|
|
100
100
|
it "should not exist in directories before save" do
|
101
|
-
s3.directories.all.map {|directory| directory.name}.include?(@directory.name).should be_false
|
101
|
+
AWS[:s3].directories.all.map {|directory| directory.name}.include?(@directory.name).should be_false
|
102
102
|
end
|
103
103
|
|
104
104
|
it "should exist in directories after save" do
|
105
105
|
@directory.save
|
106
|
-
s3.directories.all.map {|directory| directory.name}.include?(@directory.name).should be_true
|
106
|
+
AWS[:s3].directories.all.map {|directory| directory.name}.include?(@directory.name).should be_true
|
107
107
|
@directory.destroy
|
108
108
|
end
|
109
109
|
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe 'Fog::AWS::S3::File' do
|
4
4
|
|
5
5
|
before(:each) do
|
6
|
-
@directory = s3.directories.create(:name => 'fogdirectoryname')
|
6
|
+
@directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
|
7
7
|
end
|
8
8
|
|
9
9
|
after(:each) do
|
@@ -53,7 +53,7 @@ describe 'Fog::AWS::S3::File' do
|
|
53
53
|
describe "#copy" do
|
54
54
|
|
55
55
|
it "should return a Fog::AWS::S3::File with matching attributes" do
|
56
|
-
other_directory = s3.directories.create(:name => 'fogotherdirectoryname')
|
56
|
+
other_directory = AWS[:s3].directories.create(:name => 'fogotherdirectoryname')
|
57
57
|
data = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
|
58
58
|
file = @directory.files.create(:key => 'fogfilename', :body => data)
|
59
59
|
other_file = file.copy('fogotherdirectoryname', 'fogotherfilename')
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
|
|
3
3
|
describe 'Fog::AWS::S3::Files' do
|
4
4
|
|
5
5
|
before(:each) do
|
6
|
-
@directory = s3.directories.create(:name => 'fogdirectoryname')
|
6
|
+
@directory = AWS[:s3].directories.create(:name => 'fogdirectoryname')
|
7
7
|
end
|
8
8
|
|
9
9
|
after(:each) do
|
@@ -30,7 +30,7 @@ describe 'Fog::AWS::S3::Files' do
|
|
30
30
|
describe "#all" do
|
31
31
|
|
32
32
|
it "should return nil if the directory does not exist" do
|
33
|
-
directory = s3.directories.new(:name => 'notadirectory')
|
33
|
+
directory = AWS[:s3].directories.new(:name => 'notadirectory')
|
34
34
|
directory.files.all.should be_nil
|
35
35
|
end
|
36
36
|
|
@@ -4,11 +4,11 @@ describe 'EC2.allocate_address' do
|
|
4
4
|
describe 'success' do
|
5
5
|
|
6
6
|
after(:each) do
|
7
|
-
ec2.release_address(@public_ip)
|
7
|
+
AWS[:ec2].release_address(@public_ip)
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should return proper attributes" do
|
11
|
-
actual = ec2.allocate_address
|
11
|
+
actual = AWS[:ec2].allocate_address
|
12
12
|
actual.body['requestId'].should be_a(String)
|
13
13
|
@public_ip = actual.body['publicIp']
|
14
14
|
actual.body['publicIp'].should be_a(String)
|
@@ -4,38 +4,40 @@ describe 'EC2.associate_address' do
|
|
4
4
|
describe 'success' do
|
5
5
|
|
6
6
|
before(:each) do
|
7
|
-
@instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
8
|
-
@public_ip = ec2.allocate_address.body['publicIp']
|
7
|
+
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
8
|
+
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
9
9
|
end
|
10
10
|
|
11
11
|
after(:each) do
|
12
|
-
ec2.release_address(@public_ip)
|
13
|
-
ec2.terminate_instances(@instance_id)
|
12
|
+
AWS[:ec2].release_address(@public_ip)
|
13
|
+
AWS[:ec2].terminate_instances(@instance_id)
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should return proper attributes" do
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
eventually(128) do
|
18
|
+
actual = AWS[:ec2].associate_address(@instance_id, @public_ip)
|
19
|
+
actual.body['requestId'].should be_a(String)
|
20
|
+
[false, true].should include(actual.body['return'])
|
21
|
+
end
|
20
22
|
end
|
21
23
|
|
22
24
|
end
|
23
25
|
describe 'failure' do
|
24
26
|
|
25
27
|
it "should raise a BadRequest error if the instance does not exist" do
|
26
|
-
@public_ip = ec2.allocate_address.body['publicIp']
|
28
|
+
@public_ip = AWS[:ec2].allocate_address.body['publicIp']
|
27
29
|
lambda {
|
28
|
-
ec2.associate_address('i-00000000', @public_ip)
|
30
|
+
AWS[:ec2].associate_address('i-00000000', @public_ip)
|
29
31
|
}.should raise_error(Excon::Errors::BadRequest)
|
30
|
-
ec2.release_address(@public_ip)
|
32
|
+
AWS[:ec2].release_address(@public_ip)
|
31
33
|
end
|
32
34
|
|
33
35
|
it "should raise a BadRequest error if the address does not exist" do
|
34
|
-
@instance_id = ec2.run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
36
|
+
@instance_id = AWS[:ec2].run_instances(GENTOO_AMI, 1, 1).body['instancesSet'].first['instanceId']
|
35
37
|
lambda {
|
36
|
-
ec2.associate_address(@instance_id, '127.0.0.1')
|
38
|
+
AWS[:ec2].associate_address(@instance_id, '127.0.0.1')
|
37
39
|
}.should raise_error(Excon::Errors::BadRequest)
|
38
|
-
ec2.terminate_instances(@instance_id)
|
40
|
+
AWS[:ec2].terminate_instances(@instance_id)
|
39
41
|
end
|
40
42
|
|
41
43
|
end
|