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

Fixed Fog::AWS::SimpleDB#delete_attributes.

Deleting attributes was not working in mock mode. There were two
bugs in this function.The first was that attributes were being
deleted from the domain as opposed to the item. The second was
that when no attributes were passed, which should delete all
attributes, no attributes were actually being deleted. I've written
tests that recreate these bugs and I have included a fix as well.
This commit is contained in:
Pan Thomakos 2011-05-28 10:08:40 -07:00
parent 2398bfcee0
commit f739865bb5
2 changed files with 30 additions and 4 deletions

View file

@ -36,14 +36,30 @@ Shindo.tests('AWS::SimpleDB | attributes requests', ['aws']) do
AWS[:sdb].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
AWS[:sdb].delete_attributes(@domain_name, 'a', {'d' => []}).body
end
# Verify that individually deleted attributes are actually removed.
tests("#get_attributes('#{@domain_name}', 'a', ['d']).body['Attributes']").returns({'d' => nil}) do
AWS[:sdb].get_attributes(@domain_name, 'a', ['d']).body['Attributes']
end
tests("#delete_attributes('#{@domain_name}', 'a').body").formats(AWS::SimpleDB::Formats::BASIC) do
AWS[:sdb].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
AWS[:sdb].delete_attributes(@domain_name, 'a').body
end
# Verify that deleting a domain, item combination removes all related attributes.
tests("#get_attributes('#{@domain_name}', 'a').body['Attributes']").returns({}) do
AWS[:sdb].get_attributes(@domain_name, 'a').body['Attributes']
end
end
tests('failure') do