Merge pull request #1333 from terrycain/fix_1043
DynamoDB: Fixed requiring optional parameter
This commit is contained in:
commit
123f369e6e
2 changed files with 32 additions and 3 deletions
|
|
@ -967,3 +967,31 @@ def test_set_ttl():
|
|||
|
||||
resp = client.describe_time_to_live(TableName='test1')
|
||||
resp['TimeToLiveDescription']['TimeToLiveStatus'].should.equal('DISABLED')
|
||||
|
||||
|
||||
# https://github.com/spulec/moto/issues/1043
|
||||
@mock_dynamodb2
|
||||
def test_query_missing_expr_names():
|
||||
client = boto3.client('dynamodb', region_name='us-east-1')
|
||||
|
||||
# Create the DynamoDB table.
|
||||
client.create_table(
|
||||
TableName='test1',
|
||||
AttributeDefinitions=[{'AttributeName': 'client', 'AttributeType': 'S'}, {'AttributeName': 'app', 'AttributeType': 'S'}],
|
||||
KeySchema=[{'AttributeName': 'client', 'KeyType': 'HASH'}, {'AttributeName': 'app', 'KeyType': 'RANGE'}],
|
||||
ProvisionedThroughput={'ReadCapacityUnits': 123, 'WriteCapacityUnits': 123}
|
||||
)
|
||||
client.put_item(TableName='test1', Item={'client': {'S': 'test1'}, 'app': {'S': 'test1'}})
|
||||
client.put_item(TableName='test1', Item={'client': {'S': 'test2'}, 'app': {'S': 'test2'}})
|
||||
|
||||
resp = client.query(TableName='test1', KeyConditionExpression='client=:client',
|
||||
ExpressionAttributeValues={':client': {'S': 'test1'}})
|
||||
|
||||
resp['Count'].should.equal(1)
|
||||
resp['Items'][0]['client']['S'].should.equal('test1')
|
||||
|
||||
resp = client.query(TableName='test1', KeyConditionExpression=':name=test2',
|
||||
ExpressionAttributeNames={':name': 'client'})
|
||||
|
||||
resp['Count'].should.equal(1)
|
||||
resp['Items'][0]['client']['S'].should.equal('test2')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue