DynamoDB - Support AttributeUpdate::DELETE action (#3798)
This commit is contained in:
parent
b9a42816bd
commit
6084d6cfe8
@ -5979,7 +5979,7 @@ def test_dynamodb_update_item_fails_on_string_sets():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@moto.mock_dynamodb2
|
@mock_dynamodb2
|
||||||
def test_update_item_add_to_list_using_legacy_attribute_updates():
|
def test_update_item_add_to_list_using_legacy_attribute_updates():
|
||||||
resource = boto3.resource("dynamodb", region_name="us-west-2")
|
resource = boto3.resource("dynamodb", region_name="us-west-2")
|
||||||
resource.create_table(
|
resource.create_table(
|
||||||
@ -6011,6 +6011,30 @@ def test_get_item_for_non_existent_table_raises_error():
|
|||||||
ex.value.response["Error"]["Message"].should.equal("Requested resource not found")
|
ex.value.response["Error"]["Message"].should.equal("Requested resource not found")
|
||||||
|
|
||||||
|
|
||||||
|
@mock_dynamodb2
|
||||||
|
def test_attribute_item_delete():
|
||||||
|
name = "TestTable"
|
||||||
|
conn = boto3.client("dynamodb", region_name="eu-west-1")
|
||||||
|
conn.create_table(
|
||||||
|
TableName=name,
|
||||||
|
AttributeDefinitions=[{"AttributeName": "name", "AttributeType": "S"}],
|
||||||
|
KeySchema=[{"AttributeName": "name", "KeyType": "HASH"}],
|
||||||
|
)
|
||||||
|
|
||||||
|
item_name = "foo"
|
||||||
|
conn.put_item(
|
||||||
|
TableName=name, Item={"name": {"S": item_name}, "extra": {"S": "bar"}}
|
||||||
|
)
|
||||||
|
|
||||||
|
conn.update_item(
|
||||||
|
TableName=name,
|
||||||
|
Key={"name": {"S": item_name}},
|
||||||
|
AttributeUpdates={"extra": {"Action": "DELETE"}},
|
||||||
|
)
|
||||||
|
items = conn.scan(TableName=name)["Items"]
|
||||||
|
items.should.equal([{"name": {"S": "foo"}}])
|
||||||
|
|
||||||
|
|
||||||
@mock_dynamodb2
|
@mock_dynamodb2
|
||||||
def test_gsi_key_can_be_updated():
|
def test_gsi_key_can_be_updated():
|
||||||
name = "TestTable"
|
name = "TestTable"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user