mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|simpledb] fix tests to use proper accessor
This commit is contained in:
parent
2f9654993e
commit
d1ad49dc55
2 changed files with 25 additions and 25 deletions
|
@ -2,57 +2,57 @@ Shindo.tests('AWS::SimpleDB | attributes requests', ['aws']) do
|
|||
|
||||
@domain_name = "fog_domain_#{Time.now.to_f.to_s.gsub('.','')}"
|
||||
|
||||
Fog::AWS[:sdb].create_domain(@domain_name)
|
||||
Fog::AWS[:simpledb].create_domain(@domain_name)
|
||||
|
||||
tests('success') do
|
||||
|
||||
tests("#batch_put_attributes('#{@domain_name}', { 'a' => { 'b' => 'c', 'd' => 'e' }, 'x' => { 'y' => 'z' } }).body").formats(AWS::SimpleDB::Formats::BASIC) do
|
||||
Fog::AWS[:sdb].batch_put_attributes(@domain_name, { 'a' => { 'b' => 'c', 'd' => 'e' }, 'x' => { 'y' => 'z' } }).body
|
||||
Fog::AWS[:simpledb].batch_put_attributes(@domain_name, { 'a' => { 'b' => 'c', 'd' => 'e' }, 'x' => { 'y' => 'z' } }).body
|
||||
end
|
||||
|
||||
tests("#get_attributes('#{@domain_name}', 'a', {'ConsistentRead' => true}).body['Attributes']").returns({'b' => ['c'], 'd' => ['e']}) do
|
||||
Fog::AWS[:sdb].get_attributes(@domain_name, 'a', {'ConsistentRead' => true}).body['Attributes']
|
||||
Fog::AWS[:simpledb].get_attributes(@domain_name, 'a', {'ConsistentRead' => true}).body['Attributes']
|
||||
end
|
||||
|
||||
tests("#get_attributes('#{@domain_name}', 'AttributeName' => 'notanattribute')").succeeds do
|
||||
Fog::AWS[:sdb].get_attributes(@domain_name, 'AttributeName' => 'notanattribute')
|
||||
Fog::AWS[:simpledb].get_attributes(@domain_name, 'AttributeName' => 'notanattribute')
|
||||
end
|
||||
|
||||
tests("#select('select * from #{@domain_name}', {'ConsistentRead' => true}).body['Items']").returns({'a' => { 'b' => ['c'], 'd' => ['e']}, 'x' => { 'y' => ['z'] } }) do
|
||||
pending if Fog.mocking?
|
||||
Fog::AWS[:sdb].select("select * from #{@domain_name}", {'ConsistentRead' => true}).body['Items']
|
||||
Fog::AWS[:simpledb].select("select * from #{@domain_name}", {'ConsistentRead' => true}).body['Items']
|
||||
end
|
||||
|
||||
tests("#put_attributes('#{@domain_name}', 'conditional', { 'version' => '1' }).body").formats(AWS::SimpleDB::Formats::BASIC) do
|
||||
Fog::AWS[:sdb].put_attributes(@domain_name, 'conditional', { 'version' => '1' }).body
|
||||
Fog::AWS[:simpledb].put_attributes(@domain_name, 'conditional', { 'version' => '1' }).body
|
||||
end
|
||||
|
||||
tests("#put_attributes('#{@domain_name}', 'conditional', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version']).body").formats(AWS::SimpleDB::Formats::BASIC) do
|
||||
Fog::AWS[:sdb].put_attributes(@domain_name, 'conditional', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version']).body
|
||||
Fog::AWS[:simpledb].put_attributes(@domain_name, 'conditional', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version']).body
|
||||
end
|
||||
|
||||
# Verify that we can delete individual attributes.
|
||||
tests("#delete_attributes('#{@domain_name}', 'a', {'d' => []})").succeeds do
|
||||
Fog::AWS[:sdb].delete_attributes(@domain_name, 'a', {'d' => []}).body
|
||||
Fog::AWS[:simpledb].delete_attributes(@domain_name, 'a', {'d' => []}).body
|
||||
end
|
||||
|
||||
# Verify that individually deleted attributes are actually removed.
|
||||
tests("#get_attributes('#{@domain_name}', 'a', {'AttributeName' => ['d'], 'ConsistentRead' => true}).body['Attributes']").returns({}) do
|
||||
Fog::AWS[:sdb].get_attributes(@domain_name, 'a', {'AttributeName' => ['d'], 'ConsistentRead' => true}).body['Attributes']
|
||||
Fog::AWS[:simpledb].get_attributes(@domain_name, 'a', {'AttributeName' => ['d'], 'ConsistentRead' => true}).body['Attributes']
|
||||
end
|
||||
|
||||
tests("#delete_attributes('#{@domain_name}', 'a').body").formats(AWS::SimpleDB::Formats::BASIC) do
|
||||
Fog::AWS[:sdb].delete_attributes(@domain_name, 'a').body
|
||||
Fog::AWS[:simpledb].delete_attributes(@domain_name, 'a').body
|
||||
end
|
||||
|
||||
# Verify that we can delete entire domain, item combinations.
|
||||
tests("#delete_attributes('#{@domain_name}', 'a').body").succeeds do
|
||||
Fog::AWS[:sdb].delete_attributes(@domain_name, 'a').body
|
||||
Fog::AWS[:simpledb].delete_attributes(@domain_name, 'a').body
|
||||
end
|
||||
|
||||
# Verify that deleting a domain, item combination removes all related attributes.
|
||||
tests("#get_attributes('#{@domain_name}', 'a', {'ConsistentRead' => true}).body['Attributes']").returns({}) do
|
||||
Fog::AWS[:sdb].get_attributes(@domain_name, 'a', {'ConsistentRead' => true}).body['Attributes']
|
||||
Fog::AWS[:simpledb].get_attributes(@domain_name, 'a', {'ConsistentRead' => true}).body['Attributes']
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -60,27 +60,27 @@ Shindo.tests('AWS::SimpleDB | attributes requests', ['aws']) do
|
|||
tests('failure') do
|
||||
|
||||
tests("#batch_put_attributes('notadomain', { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })").raises(Excon::Errors::BadRequest) do
|
||||
Fog::AWS[:sdb].batch_put_attributes('notadomain', { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
|
||||
Fog::AWS[:simpledb].batch_put_attributes('notadomain', { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
|
||||
end
|
||||
|
||||
tests("#get_attributes('notadomain', 'a')").raises(Excon::Errors::BadRequest) do
|
||||
Fog::AWS[:sdb].get_attributes('notadomain', 'a')
|
||||
Fog::AWS[:simpledb].get_attributes('notadomain', 'a')
|
||||
end
|
||||
|
||||
tests("#put_attributes('notadomain', 'conditional', { 'version' => '1' })").raises(Excon::Errors::BadRequest) do
|
||||
Fog::AWS[:sdb].put_attributes('notadomain', 'foo', { 'version' => '1' })
|
||||
Fog::AWS[:simpledb].put_attributes('notadomain', 'foo', { 'version' => '1' })
|
||||
end
|
||||
|
||||
tests("#put_attributes('#{@domain_name}', 'conditional', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version'])").raises(Excon::Errors::Conflict) do
|
||||
Fog::AWS[:sdb].put_attributes(@domain_name, 'conditional', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version'])
|
||||
Fog::AWS[:simpledb].put_attributes(@domain_name, 'conditional', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version'])
|
||||
end
|
||||
|
||||
tests("#delete_attributes('notadomain', 'a')").raises(Excon::Errors::BadRequest) do
|
||||
Fog::AWS[:sdb].delete_attributes('notadomain', 'a')
|
||||
Fog::AWS[:simpledb].delete_attributes('notadomain', 'a')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Fog::AWS[:sdb].delete_domain(@domain_name)
|
||||
Fog::AWS[:simpledb].delete_domain(@domain_name)
|
||||
|
||||
end
|
||||
|
|
|
@ -15,27 +15,27 @@ Shindo.tests('AWS::SimpleDB | domain requests', ['aws']) do
|
|||
tests('success') do
|
||||
|
||||
tests("#create_domain(#{@domain_name})").formats(AWS::SimpleDB::Formats::BASIC) do
|
||||
Fog::AWS[:sdb].create_domain(@domain_name).body
|
||||
Fog::AWS[:simpledb].create_domain(@domain_name).body
|
||||
end
|
||||
|
||||
tests("#create_domain(#{@domain_name})").succeeds do
|
||||
Fog::AWS[:sdb].create_domain(@domain_name)
|
||||
Fog::AWS[:simpledb].create_domain(@domain_name)
|
||||
end
|
||||
|
||||
tests("#domain_metadata(#{@domain_name})").formats(@domain_metadata_format) do
|
||||
Fog::AWS[:sdb].domain_metadata(@domain_name).body
|
||||
Fog::AWS[:simpledb].domain_metadata(@domain_name).body
|
||||
end
|
||||
|
||||
tests("#list_domains").formats(AWS::SimpleDB::Formats::BASIC.merge('Domains' => [String])) do
|
||||
Fog::AWS[:sdb].list_domains.body
|
||||
Fog::AWS[:simpledb].list_domains.body
|
||||
end
|
||||
|
||||
tests("#delete_domain(#{@domain_name})").formats(AWS::SimpleDB::Formats::BASIC) do
|
||||
Fog::AWS[:sdb].delete_domain(@domain_name).body
|
||||
Fog::AWS[:simpledb].delete_domain(@domain_name).body
|
||||
end
|
||||
|
||||
tests("#delete_domain(#{@domain_name})").succeeds do
|
||||
Fog::AWS[:sdb].delete_domain(@domain_name)
|
||||
Fog::AWS[:simpledb].delete_domain(@domain_name)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -43,7 +43,7 @@ Shindo.tests('AWS::SimpleDB | domain requests', ['aws']) do
|
|||
tests('failure') do
|
||||
|
||||
tests("#domain_metadata('notadomain')").raises(Excon::Errors::BadRequest) do
|
||||
Fog::AWS[:sdb].domain_metadata('notadomain')
|
||||
Fog::AWS[:simpledb].domain_metadata('notadomain')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue