Path: blob/develop/tests/unit/customizations/test_dynamodb.py
1567 views
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.1#2# Licensed under the Apache License, Version 2.0 (the "License"). You3# may not use this file except in compliance with the License. A copy of4# the License is located at5#6# http://aws.amazon.com/apache2.0/7#8# or in the "license" file accompanying this file. This file is9# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF10# ANY KIND, either express or implied. See the License for the specific11# language governing permissions and limitations under the License.12from awscli.testutils import unittest13from awscli.customizations.dynamodb import parse_last_evaluated_key_binary141516class TestParseLastEvaluatedKeyBinary(unittest.TestCase):17def assert_parsed_output(self, last_key_value, expected_output):18parsed = {19'LastEvaluatedKey': {20'FooKeyName': last_key_value,21}22}23parse_last_evaluated_key_binary(parsed=parsed)24self.assertEqual(last_key_value, expected_output)2526def test_ignores_response_without_last_evaluated_key(self):27parsed = {'Items': []}28parse_last_evaluated_key_binary(parsed=parsed)29self.assertEqual(parsed, {'Items': []})3031def test_parses_binary_key(self):32self.assert_parsed_output({'B': 'Zm9v'}, {'B': b'foo'})3334def test_ignores_strings(self):35self.assert_parsed_output({'S': 'Zm9v'}, {'S': 'Zm9v'})3637def test_ignores_numbers(self):38self.assert_parsed_output({'N': 2}, {'N': 2})394041