dynamodb2 support for default Action ('Put') in update_item (#3454)
Co-authored-by: Georgios Samaras <gsamaras@amazon.com>
This commit is contained in:
parent
9db62d32bf
commit
d068653dea
2 changed files with 28 additions and 1 deletions
|
|
@ -2251,6 +2251,30 @@ def test_update_item_with_list():
|
|||
resp["Item"].should.equal({"key": "the-key", "list": [1, 2]})
|
||||
|
||||
|
||||
# https://github.com/spulec/moto/issues/2328
|
||||
@mock_dynamodb2
|
||||
def test_update_item_with_no_action_passed_with_list():
|
||||
dynamodb = boto3.resource("dynamodb", region_name="us-east-1")
|
||||
|
||||
# Create the DynamoDB table.
|
||||
dynamodb.create_table(
|
||||
TableName="Table",
|
||||
KeySchema=[{"AttributeName": "key", "KeyType": "HASH"}],
|
||||
AttributeDefinitions=[{"AttributeName": "key", "AttributeType": "S"}],
|
||||
ProvisionedThroughput={"ReadCapacityUnits": 1, "WriteCapacityUnits": 1},
|
||||
)
|
||||
table = dynamodb.Table("Table")
|
||||
table.update_item(
|
||||
Key={"key": "the-key"},
|
||||
# Do not pass 'Action' key, in order to check that the
|
||||
# parameter's default value will be used.
|
||||
AttributeUpdates={"list": {"Value": [1, 2]}},
|
||||
)
|
||||
|
||||
resp = table.get_item(Key={"key": "the-key"})
|
||||
resp["Item"].should.equal({"key": "the-key", "list": [1, 2]})
|
||||
|
||||
|
||||
# https://github.com/spulec/moto/issues/1342
|
||||
@mock_dynamodb2
|
||||
def test_update_item_on_map():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue