DynamoDB - Transact_get_items - Remove error condition
This commit is contained in:
parent
5a7da61833
commit
caebe222d7
@ -10,7 +10,7 @@ from .exceptions import InvalidIndexNameError, InvalidUpdateExpression, ItemSize
|
|||||||
from .models import dynamodb_backends, dynamo_json_dump
|
from .models import dynamodb_backends, dynamo_json_dump
|
||||||
|
|
||||||
|
|
||||||
TRANSACTION_MAX_ITEMS = 10
|
TRANSACTION_MAX_ITEMS = 25
|
||||||
|
|
||||||
|
|
||||||
def has_empty_keys_or_values(_dict):
|
def has_empty_keys_or_values(_dict):
|
||||||
@ -850,11 +850,6 @@ class DynamoHandler(BaseResponse):
|
|||||||
|
|
||||||
return self.error('ValidationException', msg)
|
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')
|
ret_consumed_capacity = self.body.get('ReturnConsumedCapacity', 'NONE')
|
||||||
consumed_capacity = dict()
|
consumed_capacity = dict()
|
||||||
|
|
||||||
|
@ -3820,48 +3820,12 @@ def test_invalid_transact_get_items():
|
|||||||
|
|
||||||
with assert_raises(ClientError) as ex:
|
with assert_raises(ClientError) as ex:
|
||||||
client.transact_get_items(TransactItems=[
|
client.transact_get_items(TransactItems=[
|
||||||
{
|
{'Get': {'Key': {'id': {'S': '1'}}, 'TableName': 'test1'}} for i in range(26)
|
||||||
'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'}},
|
|
||||||
])
|
])
|
||||||
|
|
||||||
ex.exception.response['ResponseMetadata']['HTTPStatusCode'].should.equal(400)
|
ex.exception.response['ResponseMetadata']['HTTPStatusCode'].should.equal(400)
|
||||||
ex.exception.response['Error']['Message'].should.match(
|
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:
|
with assert_raises(ClientError) as ex:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user