DynamoDB - Transact_get_items - Remove error condition

This commit is contained in:
Bert Blommers 2020-03-12 14:24:53 +00:00
parent 5a7da61833
commit caebe222d7
2 changed files with 3 additions and 44 deletions

View File

@ -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()

View File

@ -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: