fog 0.0.29 → 0.0.30

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. data/Rakefile +1 -0
  2. data/VERSION +1 -1
  3. data/bin/fog +18 -11
  4. data/fog.gemspec +43 -14
  5. data/lib/fog.rb +7 -1
  6. data/lib/fog/aws/ec2.rb +0 -7
  7. data/lib/fog/aws/models/ec2/address.rb +22 -26
  8. data/lib/fog/aws/models/ec2/addresses.rb +7 -22
  9. data/lib/fog/aws/models/ec2/instance.rb +2 -15
  10. data/lib/fog/aws/models/ec2/instances.rb +6 -23
  11. data/lib/fog/aws/models/ec2/key_pair.rb +2 -17
  12. data/lib/fog/aws/models/ec2/key_pairs.rb +6 -23
  13. data/lib/fog/aws/models/ec2/security_group.rb +18 -22
  14. data/lib/fog/aws/models/ec2/security_groups.rb +6 -23
  15. data/lib/fog/aws/models/ec2/snapshot.rb +2 -15
  16. data/lib/fog/aws/models/ec2/snapshots.rb +7 -20
  17. data/lib/fog/aws/models/ec2/volume.rb +23 -22
  18. data/lib/fog/aws/models/ec2/volumes.rb +8 -22
  19. data/lib/fog/aws/models/s3/bucket.rb +1 -1
  20. data/lib/fog/aws/models/s3/buckets.rb +3 -20
  21. data/lib/fog/aws/models/s3/objects.rb +11 -22
  22. data/lib/fog/aws/requests/ec2/allocate_address.rb +1 -1
  23. data/lib/fog/aws/requests/ec2/associate_address.rb +2 -2
  24. data/lib/fog/aws/requests/ec2/attach_volume.rb +2 -2
  25. data/lib/fog/aws/requests/ec2/authorize_security_group_ingress.rb +1 -1
  26. data/lib/fog/aws/requests/ec2/create_key_pair.rb +2 -2
  27. data/lib/fog/aws/requests/ec2/create_security_group.rb +2 -2
  28. data/lib/fog/aws/requests/ec2/create_snapshot.rb +2 -2
  29. data/lib/fog/aws/requests/ec2/create_volume.rb +3 -3
  30. data/lib/fog/aws/requests/ec2/delete_key_pair.rb +1 -1
  31. data/lib/fog/aws/requests/ec2/delete_security_group.rb +2 -2
  32. data/lib/fog/aws/requests/ec2/delete_snapshot.rb +2 -2
  33. data/lib/fog/aws/requests/ec2/delete_volume.rb +2 -2
  34. data/lib/fog/aws/requests/ec2/describe_addresses.rb +2 -2
  35. data/lib/fog/aws/requests/ec2/describe_availability_zones.rb +1 -1
  36. data/lib/fog/aws/requests/ec2/describe_images.rb +1 -1
  37. data/lib/fog/aws/requests/ec2/describe_instances.rb +2 -2
  38. data/lib/fog/aws/requests/ec2/describe_key_pairs.rb +2 -2
  39. data/lib/fog/aws/requests/ec2/describe_regions.rb +1 -1
  40. data/lib/fog/aws/requests/ec2/describe_security_groups.rb +2 -2
  41. data/lib/fog/aws/requests/ec2/describe_snapshots.rb +2 -2
  42. data/lib/fog/aws/requests/ec2/describe_volumes.rb +2 -2
  43. data/lib/fog/aws/requests/ec2/detach_volume.rb +2 -2
  44. data/lib/fog/aws/requests/ec2/disassociate_address.rb +2 -2
  45. data/lib/fog/aws/requests/ec2/get_console_output.rb +2 -2
  46. data/lib/fog/aws/requests/ec2/reboot_instances.rb +2 -2
  47. data/lib/fog/aws/requests/ec2/release_address.rb +2 -2
  48. data/lib/fog/aws/requests/ec2/revoke_security_group_ingress.rb +1 -1
  49. data/lib/fog/aws/requests/ec2/run_instances.rb +2 -2
  50. data/lib/fog/aws/requests/ec2/terminate_instances.rb +2 -2
  51. data/lib/fog/aws/requests/s3/copy_object.rb +2 -2
  52. data/lib/fog/aws/requests/s3/delete_bucket.rb +3 -3
  53. data/lib/fog/aws/requests/s3/delete_object.rb +2 -2
  54. data/lib/fog/aws/requests/s3/get_bucket.rb +2 -2
  55. data/lib/fog/aws/requests/s3/get_bucket_location.rb +2 -2
  56. data/lib/fog/aws/requests/s3/get_object.rb +2 -2
  57. data/lib/fog/aws/requests/s3/get_request_payment.rb +2 -2
  58. data/lib/fog/aws/requests/s3/get_service.rb +1 -1
  59. data/lib/fog/aws/requests/s3/head_object.rb +1 -1
  60. data/lib/fog/aws/requests/s3/put_bucket.rb +1 -1
  61. data/lib/fog/aws/requests/s3/put_object.rb +2 -2
  62. data/lib/fog/aws/requests/s3/put_request_payment.rb +1 -1
  63. data/lib/fog/aws/requests/simpledb/batch_put_attributes.rb +2 -2
  64. data/lib/fog/aws/requests/simpledb/create_domain.rb +1 -1
  65. data/lib/fog/aws/requests/simpledb/delete_attributes.rb +2 -2
  66. data/lib/fog/aws/requests/simpledb/delete_domain.rb +1 -1
  67. data/lib/fog/aws/requests/simpledb/domain_metadata.rb +2 -2
  68. data/lib/fog/aws/requests/simpledb/get_attributes.rb +2 -2
  69. data/lib/fog/aws/requests/simpledb/list_domains.rb +1 -1
  70. data/lib/fog/aws/requests/simpledb/put_attributes.rb +1 -1
  71. data/lib/fog/aws/requests/simpledb/select.rb +1 -1
  72. data/lib/fog/aws/s3.rb +0 -7
  73. data/lib/fog/aws/simpledb.rb +0 -4
  74. data/lib/fog/collection.rb +35 -7
  75. data/lib/fog/connection.rb +10 -130
  76. data/lib/fog/model.rb +18 -13
  77. data/lib/fog/parser.rb +0 -5
  78. data/lib/fog/rackspace.rb +35 -15
  79. data/lib/fog/rackspace/files.rb +36 -6
  80. data/lib/fog/rackspace/models/servers/server.rb +2 -16
  81. data/lib/fog/rackspace/models/servers/servers.rb +6 -21
  82. data/lib/fog/rackspace/requests/files/delete_container.rb +38 -0
  83. data/lib/fog/rackspace/requests/files/delete_object.rb +39 -0
  84. data/lib/fog/rackspace/requests/files/get_container.rb +61 -0
  85. data/lib/fog/rackspace/requests/files/get_containers.rb +5 -7
  86. data/lib/fog/rackspace/requests/files/head_container.rb +44 -0
  87. data/lib/fog/rackspace/requests/files/head_containers.rb +1 -1
  88. data/lib/fog/rackspace/requests/files/put_container.rb +38 -0
  89. data/lib/fog/rackspace/requests/files/put_object.rb +41 -0
  90. data/lib/fog/rackspace/requests/servers/create_image.rb +6 -0
  91. data/lib/fog/rackspace/requests/servers/create_server.rb +21 -2
  92. data/lib/fog/rackspace/requests/servers/delete_server.rb +18 -3
  93. data/lib/fog/rackspace/requests/servers/get_server_details.rb +17 -5
  94. data/lib/fog/rackspace/requests/servers/list_addresses.rb +52 -0
  95. data/lib/fog/rackspace/requests/servers/list_flavors.rb +2 -4
  96. data/lib/fog/rackspace/requests/servers/list_flavors_detail.rb +41 -0
  97. data/lib/fog/rackspace/requests/servers/list_images.rb +1 -1
  98. data/lib/fog/rackspace/requests/servers/list_images_detail.rb +1 -1
  99. data/lib/fog/rackspace/requests/servers/list_private_addresses.rb +50 -0
  100. data/lib/fog/rackspace/requests/servers/list_public_addresses.rb +50 -0
  101. data/lib/fog/rackspace/requests/servers/list_servers.rb +11 -2
  102. data/lib/fog/rackspace/requests/servers/list_servers_detail.rb +17 -2
  103. data/lib/fog/rackspace/requests/servers/reboot_server.rb +3 -6
  104. data/lib/fog/rackspace/requests/servers/update_server.rb +18 -5
  105. data/lib/fog/rackspace/servers.rb +20 -0
  106. data/spec/aws/models/ec2/address_spec.rb +4 -4
  107. data/spec/aws/models/ec2/instance_spec.rb +6 -6
  108. data/spec/aws/models/ec2/key_pair_spec.rb +5 -5
  109. data/spec/aws/models/ec2/security_group_spec.rb +5 -5
  110. data/spec/aws/models/ec2/snapshot_spec.rb +8 -8
  111. data/spec/aws/models/ec2/snapshots_spec.rb +6 -6
  112. data/spec/aws/models/ec2/volume_spec.rb +6 -5
  113. data/spec/aws/models/ec2/volumes_spec.rb +4 -4
  114. data/spec/aws/requests/ec2/associate_address_spec.rb +2 -2
  115. data/spec/aws/requests/ec2/attach_volume_spec.rb +2 -2
  116. data/spec/aws/requests/ec2/create_key_pair_spec.rb +1 -1
  117. data/spec/aws/requests/ec2/create_security_group_spec.rb +1 -1
  118. data/spec/aws/requests/ec2/create_snapshot_spec.rb +1 -1
  119. data/spec/aws/requests/ec2/delete_security_group_spec.rb +1 -1
  120. data/spec/aws/requests/ec2/delete_snapshot_spec.rb +1 -1
  121. data/spec/aws/requests/ec2/delete_volume_spec.rb +2 -2
  122. data/spec/aws/requests/ec2/describe_addresses_spec.rb +1 -1
  123. data/spec/aws/requests/ec2/describe_instances_spec.rb +1 -1
  124. data/spec/aws/requests/ec2/describe_key_pairs_spec.rb +1 -1
  125. data/spec/aws/requests/ec2/describe_security_groups_spec.rb +1 -1
  126. data/spec/aws/requests/ec2/describe_snapshots_spec.rb +1 -1
  127. data/spec/aws/requests/ec2/describe_volumes_spec.rb +1 -1
  128. data/spec/aws/requests/ec2/detach_volume_spec.rb +1 -1
  129. data/spec/aws/requests/ec2/disassociate_address_spec.rb +1 -1
  130. data/spec/aws/requests/ec2/get_console_output_spec.rb +1 -1
  131. data/spec/aws/requests/ec2/reboot_instances_spec.rb +1 -1
  132. data/spec/aws/requests/ec2/release_address_spec.rb +1 -1
  133. data/spec/aws/requests/ec2/terminate_instances_spec.rb +1 -1
  134. data/spec/aws/requests/s3/copy_object_spec.rb +4 -5
  135. data/spec/aws/requests/s3/delete_bucket_spec.rb +3 -4
  136. data/spec/aws/requests/s3/delete_object_spec.rb +2 -3
  137. data/spec/aws/requests/s3/get_bucket_location_spec.rb +1 -1
  138. data/spec/aws/requests/s3/get_bucket_spec.rb +4 -6
  139. data/spec/aws/requests/s3/get_object_spec.rb +6 -10
  140. data/spec/aws/requests/s3/get_request_payment_spec.rb +1 -1
  141. data/spec/aws/requests/s3/head_object_spec.rb +2 -4
  142. data/spec/aws/requests/s3/put_object_spec.rb +4 -7
  143. data/spec/aws/requests/s3/put_request_payment_spec.rb +1 -1
  144. data/spec/aws/requests/simpledb/batch_put_attributes_spec.rb +1 -1
  145. data/spec/aws/requests/simpledb/delete_attributes_spec.rb +1 -1
  146. data/spec/aws/requests/simpledb/domain_metadata_spec.rb +1 -1
  147. data/spec/aws/requests/simpledb/get_attributes_spec.rb +1 -1
  148. data/spec/aws/requests/simpledb/put_attributes_spec.rb +1 -1
  149. data/spec/rackspace/requests/files/delete_container_spec.rb +24 -0
  150. data/spec/rackspace/requests/files/delete_object_spec.rb +37 -0
  151. data/spec/rackspace/requests/files/get_container_spec.rb +33 -0
  152. data/spec/rackspace/requests/files/get_containers_spec.rb +12 -1
  153. data/spec/rackspace/requests/files/head_container_spec.rb +30 -0
  154. data/spec/rackspace/requests/files/head_containers_spec.rb +9 -1
  155. data/spec/rackspace/requests/files/put_container_spec.rb +15 -0
  156. data/spec/rackspace/requests/files/put_object_spec.rb +20 -0
  157. data/spec/rackspace/requests/servers/create_image_spec.rb +16 -2
  158. data/spec/rackspace/requests/servers/create_server_spec.rb +1 -1
  159. data/spec/rackspace/requests/servers/delete_image_spec.rb +32 -0
  160. data/spec/rackspace/requests/servers/delete_server_spec.rb +1 -1
  161. data/spec/rackspace/requests/servers/get_server_details_spec.rb +1 -1
  162. data/spec/rackspace/requests/servers/list_addresses_spec.rb +34 -0
  163. data/spec/rackspace/requests/servers/list_flavors_detail_spec.rb +17 -0
  164. data/spec/rackspace/requests/servers/list_flavors_spec.rb +6 -3
  165. data/spec/rackspace/requests/servers/list_images_detail_spec.rb +18 -0
  166. data/spec/rackspace/requests/servers/list_images_spec.rb +5 -2
  167. data/spec/rackspace/requests/servers/list_private_addresses_spec.rb +32 -0
  168. data/spec/rackspace/requests/servers/list_public_addresses_spec.rb +32 -0
  169. data/spec/rackspace/requests/servers/list_servers_detail_spec.rb +1 -1
  170. data/spec/rackspace/requests/servers/reboot_server_spec.rb +31 -0
  171. data/spec/rackspace/requests/servers/update_server_spec.rb +33 -0
  172. data/spec/spec_helper.rb +5 -1
  173. metadata +50 -14
  174. data/benchs/headers_split_vs_match.rb +0 -18
  175. data/benchs/stripping.rb +0 -26
  176. data/lib/fog/errors.rb +0 -145
  177. data/lib/fog/response.rb +0 -12
  178. data/spec/rackspace/requests/servers/delete_image.rb +0 -12
  179. data/spec/rackspace/requests/servers/list_images_detail.rb +0 -12
  180. data/spec/rackspace/requests/servers/reboot_server.rb +0 -12
  181. data/spec/rackspace/requests/servers/update_server.rb +0 -12
@@ -31,7 +31,7 @@ describe 'EC2.describe_addresses' do
31
31
  it "should raise a BadRequest error if ip does not exist" do
32
32
  lambda {
33
33
  ec2.describe_addresses('127.0.0.1')
34
- }.should raise_error(Fog::Errors::BadRequest)
34
+ }.should raise_error(Excon::Errors::BadRequest)
35
35
  end
36
36
 
37
37
  end
@@ -79,7 +79,7 @@ describe 'EC2.describe_instances' do
79
79
  it 'should raise a BadRequest error if the instance does not exist' do
80
80
  lambda {
81
81
  ec2.describe_instances('i-00000000')
82
- }.should raise_error(Fog::Errors::BadRequest)
82
+ }.should raise_error(Excon::Errors::BadRequest)
83
83
  end
84
84
 
85
85
  end
@@ -35,7 +35,7 @@ describe 'EC2.describe_key_pairs' do
35
35
  it "should raise a BadRequest error if the key does not exist" do
36
36
  lambda {
37
37
  ec2.describe_key_pairs('fog_not_a_key_name')
38
- }.should raise_error(Fog::Errors::BadRequest)
38
+ }.should raise_error(Excon::Errors::BadRequest)
39
39
  end
40
40
 
41
41
  end
@@ -44,7 +44,7 @@ describe 'EC2.describe_security_groups' do
44
44
  it "should raise a BadRequest error if the security group does not exist" do
45
45
  lambda {
46
46
  ec2.describe_security_groups('not_a_security_group')
47
- }.should raise_error(Fog::Errors::BadRequest)
47
+ }.should raise_error(Excon::Errors::BadRequest)
48
48
  end
49
49
 
50
50
  end
@@ -47,7 +47,7 @@ describe 'EC2.describe_snapshots' do
47
47
  it "should raise a BadRequest error if the snapshot does not exist" do
48
48
  lambda {
49
49
  ec2.describe_snapshots('snap-00000000')
50
- }.should raise_error(Fog::Errors::BadRequest)
50
+ }.should raise_error(Excon::Errors::BadRequest)
51
51
  end
52
52
 
53
53
  end
@@ -43,7 +43,7 @@ describe 'EC2.describe_volumes' do
43
43
  it "should raise a BadRequest error if volume does not exist" do
44
44
  lambda {
45
45
  ec2.describe_volumes('vol-00000000')
46
- }.should raise_error(Fog::Errors::BadRequest)
46
+ }.should raise_error(Excon::Errors::BadRequest)
47
47
  end
48
48
 
49
49
  end
@@ -36,7 +36,7 @@ describe 'EC2.detach_volume' do
36
36
  it "should raise a BadRequest error if the volume does not exist" do
37
37
  lambda {
38
38
  ec2.detach_volume('vol-00000000')
39
- }.should raise_error(Fog::Errors::BadRequest)
39
+ }.should raise_error(Excon::Errors::BadRequest)
40
40
  end
41
41
 
42
42
  end
@@ -27,7 +27,7 @@ describe 'EC2.disassociate_address' do
27
27
  it "should raise a BadRequest error if the address does not exist" do
28
28
  lambda {
29
29
  ec2.disassociate_address('127.0.0.1')
30
- }.should raise_error(Fog::Errors::BadRequest)
30
+ }.should raise_error(Excon::Errors::BadRequest)
31
31
  end
32
32
 
33
33
  end
@@ -25,7 +25,7 @@ describe 'EC2.get_console_output' do
25
25
  it "should raise a BadRequest error if the instance does not exist" do
26
26
  lambda {
27
27
  ec2.get_console_output('i-00000000')
28
- }.should raise_error(Fog::Errors::BadRequest)
28
+ }.should raise_error(Excon::Errors::BadRequest)
29
29
  end
30
30
 
31
31
  end
@@ -23,7 +23,7 @@ describe 'EC2.reboot_instances' do
23
23
  it "should raise a BadRequest error if the instance does not exist" do
24
24
  lambda {
25
25
  ec2.reboot_instances('i-00000000')
26
- }.should raise_error(Fog::Errors::BadRequest)
26
+ }.should raise_error(Excon::Errors::BadRequest)
27
27
  end
28
28
 
29
29
  end
@@ -19,7 +19,7 @@ describe 'EC2.release_address' do
19
19
  it "should raise a BadRequest error if address does not exist" do
20
20
  lambda {
21
21
  ec2.release_address('127.0.0.1')
22
- }.should raise_error(Fog::Errors::BadRequest)
22
+ }.should raise_error(Excon::Errors::BadRequest)
23
23
  end
24
24
 
25
25
  end
@@ -28,7 +28,7 @@ describe 'EC2.terminate_instances' do
28
28
  it 'should raise a BadRequest error if the instance does not exist' do
29
29
  lambda {
30
30
  ec2.terminate_instances('i-00000000')
31
- }.should raise_error(Fog::Errors::BadRequest)
31
+ }.should raise_error(Excon::Errors::BadRequest)
32
32
  end
33
33
 
34
34
  end
@@ -5,8 +5,7 @@ describe 'S3.copy_object' do
5
5
 
6
6
  before(:each) do
7
7
  s3.put_bucket('fogcopyobjectsource')
8
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
9
- s3.put_object('fogcopyobjectsource', 'fog_copy_object_source', file)
8
+ s3.put_object('fogcopyobjectsource', 'fog_copy_object_source', lorem_file)
10
9
  s3.put_bucket('fogcopyobjectdestination')
11
10
  end
12
11
 
@@ -36,7 +35,7 @@ describe 'S3.copy_object' do
36
35
  'fognotabucket', 'fog_copy_object_source',
37
36
  'fogcopyobjectdestination', 'fog_copy_object_destination'
38
37
  )
39
- }.should raise_error(Fog::Errors::NotFound)
38
+ }.should raise_error(Excon::Errors::NotFound)
40
39
  end
41
40
 
42
41
  it 'should raise a NotFound error if the source_object does not exist' do
@@ -45,7 +44,7 @@ describe 'S3.copy_object' do
45
44
  'fogcopyobjectsource', 'fog_not_an_object',
46
45
  'fogcopyobjectdestination', 'fog_copy_object_destination'
47
46
  )
48
- }.should raise_error(Fog::Errors::NotFound)
47
+ }.should raise_error(Excon::Errors::NotFound)
49
48
  end
50
49
 
51
50
  it 'should raise a NotFound error if the target_bucket does not exist' do
@@ -54,7 +53,7 @@ describe 'S3.copy_object' do
54
53
  'fogcopyobjectsource', 'fog_copy_object_source',
55
54
  'fognotabucket', 'fog_copy_object_destination'
56
55
  )
57
- }.should raise_error(Fog::Errors::NotFound)
56
+ }.should raise_error(Excon::Errors::NotFound)
58
57
  end
59
58
 
60
59
  end
@@ -18,16 +18,15 @@ describe 'S3.delete_bucket' do
18
18
  it 'should raise a NotFound error if the bucket does not exist' do
19
19
  lambda {
20
20
  s3.delete_bucket('fognotabucket')
21
- }.should raise_error(Fog::Errors::NotFound)
21
+ }.should raise_error(Excon::Errors::NotFound)
22
22
  end
23
23
 
24
24
  it 'should raise a Conflict error if the bucket is not empty' do
25
25
  s3.put_bucket('fogdeletebucket')
26
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
27
- s3.put_object('fogdeletebucket', 'fog_delete_object', file)
26
+ s3.put_object('fogdeletebucket', 'fog_delete_object', lorem_file)
28
27
  lambda {
29
28
  s3.delete_bucket('fogdeletebucket')
30
- }.should raise_error(Fog::Errors::Conflict)
29
+ }.should raise_error(Excon::Errors::Conflict)
31
30
  s3.delete_object('fogdeletebucket', 'fog_delete_object')
32
31
  s3.delete_bucket('fogdeletebucket')
33
32
  end
@@ -5,8 +5,7 @@ describe 'S3.delete_object' do
5
5
 
6
6
  before(:each) do
7
7
  s3.put_bucket('fogdeleteobject')
8
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
9
- s3.put_object('fogdeleteobject', 'fog_delete_object', file)
8
+ s3.put_object('fogdeleteobject', 'fog_delete_object', lorem_file)
10
9
  end
11
10
 
12
11
  after(:each) do
@@ -24,7 +23,7 @@ describe 'S3.delete_object' do
24
23
  it 'should raise a NotFound error if the bucket does not exist' do
25
24
  lambda {
26
25
  s3.delete_object('fognotabucket', 'fog_delete_object')
27
- }.should raise_error(Fog::Errors::NotFound)
26
+ }.should raise_error(Excon::Errors::NotFound)
28
27
  end
29
28
 
30
29
  it 'should not raise an error if the object does not exist' do
@@ -23,7 +23,7 @@ describe 'S3.get_bucket_location' do
23
23
  it 'should raise NotFound error if bucket does not exist' do
24
24
  lambda {
25
25
  s3.get_bucket_location('fognotabucket')
26
- }.should raise_error(Fog::Errors::NotFound)
26
+ }.should raise_error(Excon::Errors::NotFound)
27
27
  end
28
28
 
29
29
  end
@@ -5,10 +5,8 @@ describe 'S3.get_bucket' do
5
5
 
6
6
  before(:each) do
7
7
  s3.put_bucket('foggetbucket')
8
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
9
- s3.put_object('foggetbucket', 'fog_object', file)
10
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
11
- s3.put_object('foggetbucket', 'fog_other_object', file)
8
+ s3.put_object('foggetbucket', 'fog_object', lorem_file)
9
+ s3.put_object('foggetbucket', 'fog_other_object', lorem_file)
12
10
  end
13
11
 
14
12
  after(:each) do
@@ -103,13 +101,13 @@ describe 'S3.get_bucket' do
103
101
  it 'should raise a NotFound error if the bucket does not exist' do
104
102
  lambda {
105
103
  s3.get_bucket('fognotabucket')
106
- }.should raise_error(Fog::Errors::NotFound)
104
+ }.should raise_error(Excon::Errors::NotFound)
107
105
  end
108
106
 
109
107
  it 'should request non-subdomain buckets and raise a NotFound error' do
110
108
  lambda {
111
109
  s3.get_bucket('A-invalid--name')
112
- }.should raise_error(Fog::Errors::NotFound)
110
+ }.should raise_error(Excon::Errors::NotFound)
113
111
  end
114
112
 
115
113
  end
@@ -5,8 +5,7 @@ describe 'S3.get_object' do
5
5
 
6
6
  before(:each) do
7
7
  s3.put_bucket('foggetobject')
8
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
9
- s3.put_object('foggetobject', 'fog_get_object', file)
8
+ s3.put_object('foggetobject', 'fog_get_object', lorem_file)
10
9
  end
11
10
 
12
11
  after(:each) do
@@ -17,8 +16,7 @@ describe 'S3.get_object' do
17
16
  it 'should return proper attributes' do
18
17
  actual = s3.get_object('foggetobject', 'fog_get_object')
19
18
  actual.status.should == 200
20
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
21
- data = file.read
19
+ data = lorem_file.read
22
20
  actual.body.should == data
23
21
  actual.headers['Content-Length'].should == data.length.to_s
24
22
  actual.headers['Content-Type'].should be_a(String)
@@ -27,19 +25,17 @@ describe 'S3.get_object' do
27
25
  end
28
26
 
29
27
  it 'should return chunks with optional block' do
30
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
31
28
  data = ''
32
29
  s3.get_object('foggetobject', 'fog_get_object') do |chunk|
33
30
  data << chunk
34
31
  end
35
- data.should == file.read
32
+ data.should == lorem_file.read
36
33
  end
37
34
 
38
35
  it 'should return a signed expiring url' do
39
36
  url = s3.get_object_url('foggetobject', 'fog_get_object', Time.now + 60 * 10)
40
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
41
37
  unless Fog.mocking?
42
- open(url).read.should == file.read
38
+ open(url).read.should == lorem_file.read
43
39
  end
44
40
  end
45
41
 
@@ -49,13 +45,13 @@ describe 'S3.get_object' do
49
45
  it 'should raise a NotFound error if the bucket does not exist' do
50
46
  lambda {
51
47
  s3.get_object('fognotabucket', 'fog_get_object')
52
- }.should raise_error(Fog::Errors::NotFound)
48
+ }.should raise_error(Excon::Errors::NotFound)
53
49
  end
54
50
 
55
51
  it 'should raise a NotFound error if the object does not exist' do
56
52
  lambda {
57
53
  s3.get_object('foggetobject', 'fog_not_an_object')
58
- }.should raise_error(Fog::Errors::NotFound)
54
+ }.should raise_error(Excon::Errors::NotFound)
59
55
  end
60
56
 
61
57
  end
@@ -23,7 +23,7 @@ describe 'S3.get_request_payment' do
23
23
  it 'should raise a NotFound error if the bucket does not exist' do
24
24
  lambda {
25
25
  s3.get_request_payment('fognotabucket')
26
- }.should raise_error(Fog::Errors::NotFound)
26
+ }.should raise_error(Excon::Errors::NotFound)
27
27
  end
28
28
 
29
29
  end
@@ -5,8 +5,7 @@ describe 'S3.head_object' do
5
5
 
6
6
  before(:each) do
7
7
  s3.put_bucket('fogheadobject')
8
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
9
- s3.put_object('fogheadobject', 'fog_head_object', file)
8
+ s3.put_object('fogheadobject', 'fog_head_object', lorem_file)
10
9
  end
11
10
 
12
11
  after(:each) do
@@ -17,8 +16,7 @@ describe 'S3.head_object' do
17
16
  it 'should return proper attributes' do
18
17
  actual = s3.head_object('fogheadobject', 'fog_head_object')
19
18
  actual.status.should == 200
20
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
21
- data = file.read
19
+ data = lorem_file.read
22
20
  actual.headers['Content-Length'].should == data.length.to_s
23
21
  actual.headers['ETag'].should be_a(String)
24
22
  actual.headers['Last-Modified'].should be_a(String)
@@ -5,8 +5,7 @@ describe 'S3.put_object' do
5
5
 
6
6
  before(:each) do
7
7
  s3.put_bucket('fogputobject')
8
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
9
- @response = s3.put_object('fogputobject', 'fog_put_object', file)
8
+ @response = s3.put_object('fogputobject', 'fog_put_object', lorem_file)
10
9
  end
11
10
 
12
11
  after(:each) do
@@ -19,8 +18,7 @@ describe 'S3.put_object' do
19
18
  end
20
19
 
21
20
  it 'should not raise an error if the object already exists' do
22
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
23
- actual = s3.put_object('fogputobject', 'fog_put_object', file)
21
+ actual = s3.put_object('fogputobject', 'fog_put_object', lorem_file)
24
22
  actual.status.should == 200
25
23
  end
26
24
 
@@ -29,9 +27,8 @@ describe 'S3.put_object' do
29
27
 
30
28
  it 'should raise a NotFound error if the bucket does not exist' do
31
29
  lambda {
32
- file = File.open(File.dirname(__FILE__) + '/../../../lorem.txt', 'r')
33
- s3.put_object('fognotabucket', 'fog_put_object', file)
34
- }.should raise_error(Fog::Errors::NotFound)
30
+ s3.put_object('fognotabucket', 'fog_put_object', lorem_file)
31
+ }.should raise_error(Excon::Errors::NotFound)
35
32
  end
36
33
 
37
34
  end
@@ -22,7 +22,7 @@ describe 'S3.put_request_payment' do
22
22
  it 'should raise a NotFound error if bucket does not exist' do
23
23
  lambda {
24
24
  s3.put_request_payment('fognotabucket', 'Requester')
25
- }.should raise_error(Fog::Errors::NotFound)
25
+ }.should raise_error(Excon::Errors::NotFound)
26
26
  end
27
27
 
28
28
  end
@@ -24,7 +24,7 @@ describe 'SimpleDB.batch_put_attributes' do
24
24
  it 'should raise a BadRequest error if the domain does not exist' do
25
25
  lambda {
26
26
  sdb.batch_put_attributes('notadomain', { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
27
- }.should raise_error(Fog::Errors::BadRequest)
27
+ }.should raise_error(Excon::Errors::BadRequest)
28
28
  end
29
29
 
30
30
  end
@@ -25,7 +25,7 @@ describe 'SimpleDB.delete_attributes' do
25
25
  it 'shouild raise a BadRequest error if the domain does not exist' do
26
26
  lambda {
27
27
  sdb.delete_attributes('notadomain', 'notanattribute')
28
- }.should raise_error(Fog::Errors::BadRequest)
28
+ }.should raise_error(Excon::Errors::BadRequest)
29
29
  end
30
30
 
31
31
  it 'should not raise an error if the attribute does not exist' do
@@ -45,7 +45,7 @@ describe 'SimpleDB.domain_metadata' do
45
45
  it 'should raise a BadRequest error if the domain does not exist' do
46
46
  lambda {
47
47
  sdb.domain_metadata('notadomain')
48
- }.should raise_error(Fog::Errors::BadRequest)
48
+ }.should raise_error(Excon::Errors::BadRequest)
49
49
  end
50
50
 
51
51
  end
@@ -33,7 +33,7 @@ describe 'SimpleDB.get_attributes' do
33
33
  it 'should raise a BadRequest error if the domain does not exist' do
34
34
  lambda {
35
35
  sdb.get_attributes('notadomain', 'notanattribute')
36
- }.should raise_error(Fog::Errors::BadRequest)
36
+ }.should raise_error(Excon::Errors::BadRequest)
37
37
  end
38
38
 
39
39
  it 'should not raise an error if the attribute does not exist' do
@@ -24,7 +24,7 @@ describe 'SimpleDB.put_attributes' do
24
24
  it 'should raise a BadRequest error if the domain does not exist' do
25
25
  lambda {
26
26
  sdb.put_attributes(@domain_name, 'notadomain', { 'notanattribute' => 'value' })
27
- }.should raise_error(Fog::Errors::BadRequest)
27
+ }.should raise_error(Excon::Errors::BadRequest)
28
28
  end
29
29
 
30
30
  end
@@ -0,0 +1,24 @@
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
+
3
+ describe 'Rackspace::Files.delete_container' do
4
+ describe 'success' do
5
+
6
+ before(:each) do
7
+ files.put_container('container_name')
8
+ end
9
+
10
+ it "should return proper attributes" do
11
+ files.delete_container('container_name')
12
+ end
13
+
14
+ end
15
+ describe 'failure' do
16
+
17
+ it "should raise a NotFound error if the container does not exist" do
18
+ lambda do
19
+ files.delete_container('container_name')
20
+ end.should raise_error(Excon::Errors::NotFound)
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,37 @@
1
+ require File.dirname(__FILE__) + '/../../../spec_helper'
2
+
3
+ describe 'Rackspace::Files.delete_object' do
4
+ describe 'success' do
5
+
6
+ before(:each) do
7
+ files.put_container('container_name')
8
+ files.put_object('container_name', 'object_name', lorem_file)
9
+ end
10
+
11
+ after(:each) do
12
+ files.delete_container('container_name')
13
+ end
14
+
15
+ it "should return proper attributes" do
16
+ files.delete_object('container_name', 'object_name')
17
+ end
18
+
19
+ end
20
+ describe 'failure' do
21
+
22
+ it "should raise a NotFound error if the container does not exist" do
23
+ lambda do
24
+ files.delete_object('container_name', 'object_name')
25
+ end.should raise_error(Excon::Errors::NotFound)
26
+ end
27
+
28
+ it "should raise a NotFound error if the object does not exist" do
29
+ files.put_container('container_name')
30
+ lambda do
31
+ files.delete_object('container_name', 'object_name')
32
+ end.should raise_error(Excon::Errors::NotFound)
33
+ files.delete_container('container_name')
34
+ end
35
+
36
+ end
37
+ end