We shouldnt throw a ValidationException on empty dynamodb key. Closes #1505.
This commit is contained in:
parent
3373c5bf13
commit
783504c897
@ -161,8 +161,7 @@ class DynamoHandler(BaseResponse):
|
|||||||
name = self.body['TableName']
|
name = self.body['TableName']
|
||||||
item = self.body['Item']
|
item = self.body['Item']
|
||||||
|
|
||||||
res = re.search('\"\"', json.dumps(item))
|
if any(list(param.values())[0] == '' for param in item.values() if isinstance(param, dict)):
|
||||||
if res:
|
|
||||||
er = 'com.amazonaws.dynamodb.v20111205#ValidationException'
|
er = 'com.amazonaws.dynamodb.v20111205#ValidationException'
|
||||||
return (400,
|
return (400,
|
||||||
{'server': 'amazon.com'},
|
{'server': 'amazon.com'},
|
||||||
|
@ -247,6 +247,33 @@ def test_scan_returns_consumed_capacity():
|
|||||||
assert response['ConsumedCapacity']['TableName'] == name
|
assert response['ConsumedCapacity']['TableName'] == name
|
||||||
|
|
||||||
|
|
||||||
|
@requires_boto_gte("2.9")
|
||||||
|
@mock_dynamodb2
|
||||||
|
def test_put_item_with_special_chars():
|
||||||
|
name = 'TestTable'
|
||||||
|
conn = boto3.client('dynamodb',
|
||||||
|
region_name='us-west-2',
|
||||||
|
aws_access_key_id="ak",
|
||||||
|
aws_secret_access_key="sk")
|
||||||
|
|
||||||
|
conn.create_table(TableName=name,
|
||||||
|
KeySchema=[{'AttributeName':'forum_name','KeyType':'HASH'}],
|
||||||
|
AttributeDefinitions=[{'AttributeName':'forum_name','AttributeType':'S'}],
|
||||||
|
ProvisionedThroughput={'ReadCapacityUnits':5,'WriteCapacityUnits':5})
|
||||||
|
|
||||||
|
conn.put_item(
|
||||||
|
TableName=name,
|
||||||
|
Item={
|
||||||
|
'forum_name': { 'S': 'LOLCat Forum' },
|
||||||
|
'subject': { 'S': 'Check this out!' },
|
||||||
|
'Body': { 'S': 'http://url_to_lolcat.gif'},
|
||||||
|
'SentBy': { 'S': "test" },
|
||||||
|
'ReceivedTime': { 'S': '12/9/2011 11:36:03 PM'},
|
||||||
|
'"': {"S": "foo"},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@requires_boto_gte("2.9")
|
@requires_boto_gte("2.9")
|
||||||
@mock_dynamodb2
|
@mock_dynamodb2
|
||||||
def test_query_returns_consumed_capacity():
|
def test_query_returns_consumed_capacity():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user