diff --git a/tests/aws/requests/storage/bucket_tests.rb b/tests/aws/requests/storage/bucket_tests.rb
index d9d3e10b4..c0ad578f3 100644
--- a/tests/aws/requests/storage/bucket_tests.rb
+++ b/tests/aws/requests/storage/bucket_tests.rb
@@ -36,6 +36,7 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
tests("#put_bucket('#{@aws_bucket_name}')").succeeds do
Fog::Storage[:aws].put_bucket(@aws_bucket_name)
+ @aws_owner = Fog::Storage[:aws].get_bucket_acl(Fog::Storage[:aws].directories.first.key).body['Owner']
end
tests("#get_service").formats(@service_format) do
@@ -124,53 +125,34 @@ Shindo.tests('Fog::Storage[:aws] | bucket requests', [:aws]) do
Fog::Storage[:aws].put_bucket_acl(@aws_bucket_name, 'private')
end
- tests("#put_bucket_acl('#{@aws_bucket_name}', hash with id)").returns(<<-BODY) do
-
-
- 8a6925ce4adf5f21c32aa379004fef
- mtd@amazon.com
-
-
-
-
- 8a6925ce4adf588a4532142d3f74dd8c71fa124b1ddee97f21c32aa379004fef
- mtd@amazon.com
-
- FULL_CONTROL
-
-
-
-BODY
- Fog::Storage[:aws].put_bucket_acl(@aws_bucket_name, {
- 'Owner' => { 'ID' => "8a6925ce4adf5f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
- 'AccessControlList' => [
- {
- 'Grantee' => { 'ID' => "8a6925ce4adf588a4532142d3f74dd8c71fa124b1ddee97f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
- 'Permission' => "FULL_CONTROL"
- }
- ]
- })
+ acl = {
+ 'Owner' => @aws_owner,
+ 'AccessControlList' => [
+ {
+ 'Grantee' => @aws_owner,
+ 'Permission' => "FULL_CONTROL"
+ }
+ ]
+ }
+ tests("#put_bucket_acl('#{@aws_bucket_name}', hash with id)").returns(acl) do
+ pending if Fog.mocking?
+
+ Fog::Storage[:aws].put_bucket_acl(@aws_bucket_name, acl)
Fog::Storage[:aws].get_bucket_acl(@aws_bucket_name).body
end
- tests("#put_bucket_acl('#{@aws_bucket_name}', hash with email)").returns(<<-BODY) do
-
-
- 8a6925ce4adf5f21c32aa379004fef
- mtd@amazon.com
-
-
-
-
- mtd@amazon.com
-
- FULL_CONTROL
-
-
-
-BODY
+ tests("#put_bucket_acl('#{@aws_bucket_name}', hash with email)").returns({
+ 'Owner' => @aws_owner,
+ 'AccessControlList' => [
+ {
+ 'Grantee' => { 'ID' => 'f62f0218873cfa5d56ae9429ae75a592fec4fd22a5f24a20b1038a7db9a8f150', 'DisplayName' => 'mtd' },
+ 'Permission' => "FULL_CONTROL"
+ }
+ ]
+ }) do
+ pending if Fog.mocking?
Fog::Storage[:aws].put_bucket_acl(@aws_bucket_name, {
- 'Owner' => { 'ID' => "8a6925ce4adf5f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
+ 'Owner' => @aws_owner,
'AccessControlList' => [
{
'Grantee' => { 'EmailAddress' => 'mtd@amazon.com' },
@@ -181,31 +163,18 @@ BODY
Fog::Storage[:aws].get_bucket_acl(@aws_bucket_name).body
end
- tests("#put_bucket_acl('#{@aws_bucket_name}', hash with uri)").returns(<<-BODY) do
-
-
- 8a6925ce4adf5f21c32aa379004fef
- mtd@amazon.com
-
-
-
-
- http://www.w3.org/2001/XMLSchema-instance
-
- FULL_CONTROL
-
-
-
-BODY
- Fog::Storage[:aws].put_bucket_acl(@aws_bucket_name, {
- 'Owner' => { 'ID' => "8a6925ce4adf5f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
- 'AccessControlList' => [
- {
- 'Grantee' => { 'URI' => 'http://www.w3.org/2001/XMLSchema-instance' },
- 'Permission' => "FULL_CONTROL"
- }
- ]
- })
+ acl = {
+ 'Owner' => @aws_owner,
+ 'AccessControlList' => [
+ {
+ 'Grantee' => { 'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers' },
+ 'Permission' => "FULL_CONTROL"
+ }
+ ]
+ }
+ tests("#put_bucket_acl('#{@aws_bucket_name}', hash with uri)").returns(acl) do
+ pending if Fog.mocking?
+ Fog::Storage[:aws].put_bucket_acl(@aws_bucket_name, acl)
Fog::Storage[:aws].get_bucket_acl(@aws_bucket_name).body
end
@@ -258,4 +227,6 @@ BODY
end
+ # don't keep the bucket around
+ Fog::Storage[:aws].delete_bucket(@aws_bucket_name) rescue nil
end
diff --git a/tests/aws/requests/storage/object_tests.rb b/tests/aws/requests/storage/object_tests.rb
index 073f99ad1..50ebf2405 100644
--- a/tests/aws/requests/storage/object_tests.rb
+++ b/tests/aws/requests/storage/object_tests.rb
@@ -1,5 +1,6 @@
Shindo.tests('AWS::Storage | object requests', ['aws']) do
@directory = Fog::Storage[:aws].directories.create(:key => 'fogobjecttests-' + Time.now.to_i.to_s(32))
+ @aws_owner = Fog::Storage[:aws].get_bucket_acl(@directory.key).body['Owner']
tests('success') do
@@ -33,52 +34,31 @@ Shindo.tests('AWS::Storage | object requests', ['aws']) do
Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', 'private')
end
- tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with id)").returns(<
-
- 8a6925ce4adf5f21c32aa379004fef
- mtd@amazon.com
-
-
-
-
- 8a6925ce4adf588a4532142d3f74dd8c71fa124b1ddee97f21c32aa379004fef
- mtd@amazon.com
-
- FULL_CONTROL
-
-
-
-BODY
- Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', {
- 'Owner' => { 'ID' => "8a6925ce4adf5f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
- 'AccessControlList' => [
- {
- 'Grantee' => { 'ID' => "8a6925ce4adf588a4532142d3f74dd8c71fa124b1ddee97f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
- 'Permission' => "FULL_CONTROL"
- }
- ]})
+ acl = {
+ 'Owner' => @aws_owner,
+ 'AccessControlList' => [
+ {
+ 'Grantee' => @aws_owner,
+ 'Permission' => "FULL_CONTROL"
+ }
+ ]}
+ tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with id)").returns(acl) do
+ pending if Fog.mocking?
+ Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', acl)
Fog::Storage[:aws].get_object_acl(@directory.identity, 'fog_object').body
end
- tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with email)").returns(<
-
- 8a6925ce4adf5f21c32aa379004fef
- mtd@amazon.com
-
-
-
-
- mtd@amazon.com
-
- FULL_CONTROL
-
-
-
-BODY
+ tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with email)").returns({
+ 'Owner' => @aws_owner,
+ 'AccessControlList' => [
+ {
+ 'Grantee' => { 'ID' => 'f62f0218873cfa5d56ae9429ae75a592fec4fd22a5f24a20b1038a7db9a8f150', 'DisplayName' => 'mtd' },
+ 'Permission' => "FULL_CONTROL"
+ }
+ ]}) do
+ pending if Fog.mocking?
Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', {
- 'Owner' => { 'ID' => "8a6925ce4adf5f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
+ 'Owner' => @aws_owner,
'AccessControlList' => [
{
'Grantee' => { 'EmailAddress' => 'mtd@amazon.com' },
@@ -88,30 +68,17 @@ BODY
Fog::Storage[:aws].get_object_acl(@directory.identity, 'fog_object').body
end
- tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with uri)").returns(<
-
- 8a6925ce4adf5f21c32aa379004fef
- mtd@amazon.com
-
-
-
-
- http://acs.amazonaws.com/groups/global/AllUsers
-
- FULL_CONTROL
-
-
-
-BODY
- Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', {
- 'Owner' => { 'ID' => "8a6925ce4adf5f21c32aa379004fef", 'DisplayName' => "mtd@amazon.com" },
- 'AccessControlList' => [
- {
- 'Grantee' => { 'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers' },
- 'Permission' => "FULL_CONTROL"
- }
- ]})
+ acl = {
+ 'Owner' => @aws_owner,
+ 'AccessControlList' => [
+ {
+ 'Grantee' => { 'URI' => 'http://acs.amazonaws.com/groups/global/AllUsers' },
+ 'Permission' => "FULL_CONTROL"
+ }
+ ]}
+ tests("#put_object_acl('#{@directory.identity}', 'fog_object', hash with uri)").returns(acl) do
+ pending if Fog.mocking?
+ Fog::Storage[:aws].put_object_acl(@directory.identity, 'fog_object', acl)
Fog::Storage[:aws].get_object_acl(@directory.identity, 'fog_object').body
end