1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00

git grep -l "Storage::AWS" -- tests/ | xargs sed -i "" "s/Storage::AWS/AWS::Storage/g"

This commit is contained in:
sue445 2018-09-14 23:13:39 +09:00
parent ed087d80d9
commit e21685385b
3 changed files with 39 additions and 39 deletions

View file

@ -1,44 +1,44 @@
require 'fog/aws/requests/storage/acl_utils'
Shindo.tests('Fog::Storage::AWS | ACL utils', ["aws"]) do
Shindo.tests('Fog::AWS::Storage | ACL utils', ["aws"]) do
tests(".hash_to_acl") do
tests(".hash_to_acl({}) at xpath //AccessControlPolicy").returns("", "has an empty AccessControlPolicy") do
xml = Fog::Storage::AWS.hash_to_acl({})
xml = Fog::AWS::Storage.hash_to_acl({})
Nokogiri::XML(xml).xpath("//AccessControlPolicy").first.content.chomp
end
tests(".hash_to_acl({}) at xpath //AccessControlPolicy/Owner").returns(nil, "does not have an Owner element") do
xml = Fog::Storage::AWS.hash_to_acl({})
xml = Fog::AWS::Storage.hash_to_acl({})
Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner").first
end
tests(".hash_to_acl('Owner' => {}) at xpath //AccessControlPolicy/Owner").returns(nil, "does not have an Owner element") do
xml = Fog::Storage::AWS.hash_to_acl('Owner' => {})
xml = Fog::AWS::Storage.hash_to_acl('Owner' => {})
Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner").first
end
tests(".hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'}) at xpath //AccessControlPolicy/Owner/ID").returns("abcdef0123456789", "returns the Owner ID") do
xml = Fog::Storage::AWS.hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'})
xml = Fog::AWS::Storage.hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'})
Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner/ID").first.content
end
tests(".hash_to_acl('Owner' => {'DisplayName' => 'bob'}) at xpath //AccessControlPolicy/Owner/ID").returns(nil, "does not have an Owner ID element") do
xml = Fog::Storage::AWS.hash_to_acl('Owner' => {'DisplayName' => 'bob'})
xml = Fog::AWS::Storage.hash_to_acl('Owner' => {'DisplayName' => 'bob'})
Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner/ID").first
end
tests(".hash_to_acl('Owner' => {'DisplayName' => 'bob'}) at xpath //AccessControlPolicy/Owner/DisplayName").returns("bob", "returns the Owner DisplayName") do
xml = Fog::Storage::AWS.hash_to_acl('Owner' => {'DisplayName' => 'bob'})
xml = Fog::AWS::Storage.hash_to_acl('Owner' => {'DisplayName' => 'bob'})
Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner/DisplayName").first.content
end
tests(".hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'}) at xpath //AccessControlPolicy/Owner/DisplayName").returns(nil, "does not have an Owner DisplayName element") do
xml = Fog::Storage::AWS.hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'})
xml = Fog::AWS::Storage.hash_to_acl('Owner' => {'ID' => 'abcdef0123456789'})
Nokogiri::XML(xml).xpath("//AccessControlPolicy/Owner/DisplayName").first
end
tests(".hash_to_acl({}) at xpath //AccessControlPolicy/AccessControlList").returns(nil, "has no AccessControlList") do
xml = Fog::Storage::AWS.hash_to_acl({})
xml = Fog::AWS::Storage.hash_to_acl({})
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlPolicy").first
end
@ -55,22 +55,22 @@ Shindo.tests('Fog::Storage::AWS | ACL utils', ["aws"]) do
}
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee").returns("CanonicalUser", "has an xsi:type of CanonicalUser") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee").first.attributes["type"].value
end
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/ID").returns("abcdef0123456789", "returns the Grantee ID") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/ID").first.content
end
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/DisplayName").returns("bob", "returns the Grantee DisplayName") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/DisplayName").first.content
end
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Permission").returns("READ", "returns the Grantee Permission") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Permission").first.content
end
@ -86,17 +86,17 @@ Shindo.tests('Fog::Storage::AWS | ACL utils', ["aws"]) do
}
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee").returns("AmazonCustomerByEmail", "has an xsi:type of AmazonCustomerByEmail") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee").first.attributes["type"].value
end
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/EmailAddress").returns("user@example.com", "returns the Grantee EmailAddress") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/EmailAddress").first.content
end
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Permission").returns("FULL_CONTROL", "returns the Grantee Permission") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Permission").first.content
end
@ -112,17 +112,17 @@ Shindo.tests('Fog::Storage::AWS | ACL utils', ["aws"]) do
}
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee").returns("Group", "has an xsi:type of Group") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee").first.attributes["type"].value
end
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/URI").returns("http://acs.amazonaws.com/groups/global/AllUsers", "returns the Grantee URI") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/URI").first.content
end
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Permission").returns("WRITE", "returns the Grantee Permission") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Permission").first.content
end
@ -151,22 +151,22 @@ Shindo.tests('Fog::Storage::AWS | ACL utils', ["aws"]) do
}
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant").returns(3, "has three elements") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant").size
end
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/ID").returns("abcdef0123456789", "returns the first Grant's Grantee ID") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/ID").first.content
end
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/EmailAddress").returns("user@example.com", "returns the second Grant's Grantee EmailAddress") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/EmailAddress").first.content
end
tests(".hash_to_acl(#{acl.inspect}) at xpath //AccessControlPolicy/AccessControlList/Grant/Grantee/URI").returns("http://acs.amazonaws.com/groups/global/AllUsers", "returns the third Grant's Grantee URI") do
xml = Fog::Storage::AWS.hash_to_acl(acl)
xml = Fog::AWS::Storage.hash_to_acl(acl)
Nokogiri::XML(xml).xpath("//AccessControlPolicy/AccessControlList/Grant/Grantee/URI").first.content
end
end
@ -203,7 +203,7 @@ XML
"Permission" => "FULL_CONTROL"
}]
}, 'returns hash of ACL XML') do
Fog::Storage::AWS.acl_to_hash(acl_xml)
Fog::AWS::Storage.acl_to_hash(acl_xml)
end
end
end

View file

@ -1,14 +1,14 @@
require 'fog/aws/requests/storage/cors_utils'
Shindo.tests('Fog::Storage::AWS | CORS utils', ["aws"]) do
Shindo.tests('Fog::AWS::Storage | CORS utils', ["aws"]) do
tests(".hash_to_cors") do
tests(".hash_to_cors({}) at xpath //CORSConfiguration").returns("", "has an empty CORSConfiguration") do
xml = Fog::Storage::AWS.hash_to_cors({})
xml = Fog::AWS::Storage.hash_to_cors({})
Nokogiri::XML(xml).xpath("//CORSConfiguration").first.content.chomp
end
tests(".hash_to_cors({}) at xpath //CORSConfiguration/CORSRule").returns(nil, "has no CORSRules") do
xml = Fog::Storage::AWS.hash_to_cors({})
xml = Fog::AWS::Storage.hash_to_cors({})
Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule").first
end
@ -26,52 +26,52 @@ Shindo.tests('Fog::Storage::AWS | CORS utils', ["aws"]) do
}
tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedOrigin").returns("origin_123", "returns the CORSRule AllowedOrigin") do
xml = Fog::Storage::AWS.hash_to_cors(cors)
xml = Fog::AWS::Storage.hash_to_cors(cors)
Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedOrigin")[0].content
end
tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedOrigin").returns("origin_456", "returns the CORSRule AllowedOrigin") do
xml = Fog::Storage::AWS.hash_to_cors(cors)
xml = Fog::AWS::Storage.hash_to_cors(cors)
Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedOrigin")[1].content
end
tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedMethod").returns("GET", "returns the CORSRule AllowedMethod") do
xml = Fog::Storage::AWS.hash_to_cors(cors)
xml = Fog::AWS::Storage.hash_to_cors(cors)
Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedMethod")[0].content
end
tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedMethod").returns("POST", "returns the CORSRule AllowedMethod") do
xml = Fog::Storage::AWS.hash_to_cors(cors)
xml = Fog::AWS::Storage.hash_to_cors(cors)
Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedMethod")[1].content
end
tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedHeader").returns("Accept", "returns the CORSRule AllowedHeader") do
xml = Fog::Storage::AWS.hash_to_cors(cors)
xml = Fog::AWS::Storage.hash_to_cors(cors)
Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedHeader")[0].content
end
tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/AllowedHeader").returns("Content-Type", "returns the CORSRule AllowedHeader") do
xml = Fog::Storage::AWS.hash_to_cors(cors)
xml = Fog::AWS::Storage.hash_to_cors(cors)
Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/AllowedHeader")[1].content
end
tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/ID").returns("blah-888", "returns the CORSRule ID") do
xml = Fog::Storage::AWS.hash_to_cors(cors)
xml = Fog::AWS::Storage.hash_to_cors(cors)
Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/ID")[0].content
end
tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/MaxAgeSeconds").returns("2500", "returns the CORSRule MaxAgeSeconds") do
xml = Fog::Storage::AWS.hash_to_cors(cors)
xml = Fog::AWS::Storage.hash_to_cors(cors)
Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/MaxAgeSeconds")[0].content
end
tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/ExposeHeader").returns("x-some-header", "returns the CORSRule ExposeHeader") do
xml = Fog::Storage::AWS.hash_to_cors(cors)
xml = Fog::AWS::Storage.hash_to_cors(cors)
Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/ExposeHeader")[0].content
end
tests(".hash_to_cors(#{cors.inspect}) at xpath //CORSConfiguration/CORSRule/ExposeHeader").returns("x-other-header", "returns the CORSRule ExposeHeader") do
xml = Fog::Storage::AWS.hash_to_cors(cors)
xml = Fog::AWS::Storage.hash_to_cors(cors)
Nokogiri::XML(xml).xpath("//CORSConfiguration/CORSRule/ExposeHeader")[1].content
end
end
@ -102,7 +102,7 @@ XML
"ExposeHeader" => ["x-amz-server-side-encryption", "x-amz-balls"]
}]
}, 'returns hash of CORS XML') do
Fog::Storage::AWS.cors_to_hash(cors_xml)
Fog::AWS::Storage.cors_to_hash(cors_xml)
end
end
end

View file

@ -2,6 +2,6 @@
Shindo.tests('AWS Storage | escape', ['aws']) do
tests('Keys can contain a hierarchical prefix which should not be escaped') do
returns( Fog::Storage::AWS.new.send(:escape, "key/with/prefix") ) { "key/with/prefix" }
returns( Fog::AWS::Storage.new.send(:escape, "key/with/prefix") ) { "key/with/prefix" }
end
end