From caebe222d7846b87139a9eec08a1376db9c4d0d6 Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Thu, 12 Mar 2020 14:24:53 +0000 Subject: [PATCH] DynamoDB - Transact_get_items - Remove error condition --- moto/dynamodb2/responses.py | 7 +---- tests/test_dynamodb2/test_dynamodb.py | 40 ++------------------------- 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/moto/dynamodb2/responses.py b/moto/dynamodb2/responses.py index 90cbcedda..a5e465a1a 100644 --- a/moto/dynamodb2/responses.py +++ b/moto/dynamodb2/responses.py @@ -10,7 +10,7 @@ from .exceptions import InvalidIndexNameError, InvalidUpdateExpression, ItemSize from .models import dynamodb_backends, dynamo_json_dump -TRANSACTION_MAX_ITEMS = 10 +TRANSACTION_MAX_ITEMS = 25 def has_empty_keys_or_values(_dict): @@ -850,11 +850,6 @@ class DynamoHandler(BaseResponse): return self.error('ValidationException', msg) - dedup_list = [i for n, i in enumerate(transact_items) if i not in transact_items[n + 1:]] - if len(transact_items) != len(dedup_list): - er = 'com.amazon.coral.validate#ValidationException' - return self.error(er, 'Transaction request cannot include multiple operations on one item') - ret_consumed_capacity = self.body.get('ReturnConsumedCapacity', 'NONE') consumed_capacity = dict() diff --git a/tests/test_dynamodb2/test_dynamodb.py b/tests/test_dynamodb2/test_dynamodb.py index e439eeeb9..cfe071f44 100644 --- a/tests/test_dynamodb2/test_dynamodb.py +++ b/tests/test_dynamodb2/test_dynamodb.py @@ -3820,48 +3820,12 @@ def test_invalid_transact_get_items(): with assert_raises(ClientError) as ex: client.transact_get_items(TransactItems=[ - { - 'Get': { - 'Key': { - 'id': {'S': '1'}, - }, - 'TableName': 'test1' - } - }, - { - 'Get': { - 'Key': { - 'id': {'S': '1'}, - }, - 'TableName': 'test1' - } - } - ]) - - ex.exception.response['Error']['Code'].should.equal('ValidationException') - ex.exception.response['ResponseMetadata']['HTTPStatusCode'].should.equal(400) - ex.exception.response['Error']['Message'].should.equal( - 'Transaction request cannot include multiple operations on one item' - ) - - with assert_raises(ClientError) as ex: - client.transact_get_items(TransactItems=[ - {'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}}, - {'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}}, - {'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}}, - {'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}}, - {'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}}, - {'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}}, - {'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}}, - {'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}}, - {'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}}, - {'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}}, - {'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}}, + {'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}} for i in range(26) ]) ex.exception.response['ResponseMetadata']['HTTPStatusCode'].should.equal(400) ex.exception.response['Error']['Message'].should.match( - r'failed to satisfy constraint: Member must have length less than or equal to 10', re.I + r'failed to satisfy constraint: Member must have length less than or equal to 25', re.I ) with assert_raises(ClientError) as ex: