Permalink
Browse files

Fix handling of Expected parameter. Closes #517.

  • Loading branch information...
1 parent a2bbf63 commit fd893b3b03a6d24e9559901a27b9b8a5f41d8687 @garnaat garnaat committed Jan 30, 2012
Showing with 8 additions and 4 deletions.
  1. +4 −2 boto/dynamodb/layer2.py
  2. +4 −2 tests/dynamodb/test_layer2.py
View
@@ -115,7 +115,8 @@ def dynamize_expected_value(self, expected_value):
elif attr_value is False:
attr_value = {'Exists': False}
else:
- attr_value = self.dynamize_value(expected_value[attr_name])
+ val = self.dynamize_value(expected_value[attr_name])
+ attr_value = {'Value': val}
d[attr_name] = attr_value
return d
@@ -427,7 +428,8 @@ def delete_item(self, item, expected_value=None, return_values=None):
def query(self, table, hash_key, range_key_condition=None,
attributes_to_get=None, limit=None, consistent_read=False,
- scan_index_forward=True, exclusive_start_key=None, item_class=Item):
+ scan_index_forward=True, exclusive_start_key=None,
+ item_class=Item):
"""
Perform a query on the table.
@@ -227,11 +227,13 @@ def test_layer2_basic(self):
for i in item4['StrSetAttr']:
assert i in str_set
- # Now delete the items
- item1.delete()
+ # Try to delete the item with the right Expected value
+ expected = {'Views': 0}
+ item1.delete(expected_value=expected)
self.assertFalse(table.has_item(item1_key, range_key=item1_range,
consistent_read=True))
+ # Now delete the remaining items
item2.delete()
item3.delete()

0 comments on commit fd893b3

Please sign in to comment.