From 861c47a552db20c9f022856c66d7c2e82e506d42 Mon Sep 17 00:00:00 2001 From: sawandas <38201746+sawandas@users.noreply.github.com> Date: Mon, 9 Apr 2018 13:42:50 +0530 Subject: [PATCH] Update test cases for dynamodb contains filter --- tests/test_dynamodb2/test_dynamodb.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_dynamodb2/test_dynamodb.py b/tests/test_dynamodb2/test_dynamodb.py index d7c5b5843..1d7fa4034 100644 --- a/tests/test_dynamodb2/test_dynamodb.py +++ b/tests/test_dynamodb2/test_dynamodb.py @@ -658,6 +658,14 @@ def test_filter_expression(): {':v0': {'N': '7'}} ) filter_expr.expr(row1).should.be(True) + # Expression from to check contains on string value + filter_expr = moto.dynamodb2.comparisons.get_filter_expression( + 'contains(#n0, :v0)', + {'#n0': 'Desc'}, + {':v0': {'S': 'Some'}} + ) + filter_expr.expr(row1).should.be(True) + filter_expr.expr(row2).should.be(False) @mock_dynamodb2 @@ -699,6 +707,11 @@ def test_query_filter(): ) assert response['Count'] == 1 assert response['Items'][0]['app'] == 'app2' + response = table.query( + KeyConditionExpression=Key('client').eq('client1'), + FilterExpression=Attr('app').contains('app') + ) + assert response['Count'] == 2 @mock_dynamodb2