Skip to content

Commit cdc70cb

Browse files
author
Lucas McDonald
committed
sync
1 parent 9e4bd6f commit cdc70cb

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/encrypted/paginator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
class EncryptedPaginator(EncryptedBotoInterface):
30-
"""Wrapping class for the boto3 Paginator that decrypts returned items before returning them."""
30+
"""Wrapping class for boto3 Paginators that decrypts returned items before returning them."""
3131

3232
def __init__(
3333
self,
@@ -84,7 +84,8 @@ def paginate(self, **kwargs) -> Generator[dict, None, None]:
8484
8585
Returns:
8686
Generator[dict, None, None]: A generator yielding pages as dictionaries.
87-
The items in the pages will be decrypted locally after being read from DynamoDB.
87+
For "scan" or "query" operations, the items in the pages will be decrypted locally after being read from
88+
DynamoDB.
8889
8990
"""
9091
if self._paginator._model.name == "Query":

DynamoDbEncryption/runtimes/python/test/unit/encrypted/test_paginator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
def test_GIVEN_paginator_not_query_nor_scan_WHEN_paginate_THEN_defers_to_underlying_paginator():
2626
# Given: A paginator that is not a Query or Scan paginator
27+
# Mock an underlying paginator to spy on its call pattern
2728
underlying_paginator = MagicMock(__class__=Paginator)
2829
underlying_paginator._model.name = "NotQueryNorScan"
2930
non_query_scan_paginator = EncryptedPaginator(
@@ -38,12 +39,14 @@ def test_GIVEN_paginator_not_query_nor_scan_WHEN_paginate_THEN_defers_to_underly
3839

3940

4041
def test_GIVEN_kwargs_has_PaginationConfig_WHEN_paginate_THEN_PaginationConfig_is_added_back_to_request():
42+
# Mock an underlying paginator to spy on its call pattern
4143
mock_underlying_paginator = MagicMock(__class__=Paginator)
4244
mock_underlying_paginator._model.name = "Query"
4345
paginator = EncryptedPaginator(
4446
paginator=mock_underlying_paginator,
4547
encryption_config=mock_tables_encryption_config,
4648
)
49+
# Mock the input transform method to spy on its arguments
4750
mock_input_transform_method = MagicMock()
4851
mock_input_transform_method.return_value = QueryInputTransformOutput(transformed_input={"TableName": "test-table"})
4952
paginator._transformer.query_input_transform = mock_input_transform_method
@@ -73,6 +76,6 @@ def test_GIVEN_invalid_class_attribute_WHEN_getattr_THEN_raise_error():
7376

7477
# Then: AttributeError is raised
7578
with pytest.raises(AttributeError):
76-
# Given: Invalid class attribute: not_a_valid_attribute_on_EncryptedClient_nor_boto3_client
79+
# Given: Invalid class attribute: not_a_valid_attribute_on_EncryptedPaginator_nor_boto3_paginator
7780
# When: getattr is called
7881
encrypted_paginator.not_a_valid_attribute_on_EncryptedPaginator_nor_boto3_paginator()

Examples/runtimes/python/DynamoDBEncryption/src/encrypted_paginator/encrypted_paginator_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def encrypted_paginator_example(
152152
for item in page["Items"]:
153153
items.append(item)
154154

155-
# 9. Assert the items are as expected.
155+
# 9. Assert the items are returned as expected.
156156
assert len(items) == 1
157157
assert items[0]["attribute1"]["S"] == "encrypt and sign me!"
158158
assert items[0]["attribute2"]["S"] == "sign me!"

Examples/runtimes/python/DynamoDBEncryption/test/encrypted_paginator/test_encrypted_paginator_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
def test_encrypted_paginator_example():
12-
"""Test function for encrypt and decrypt using the EncryptedClient example."""
12+
"""Test function for encrypt and decrypt using the EncryptedPaginator example."""
1313
test_kms_key_id = "arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f"
1414
test_dynamodb_table_name = "DynamoDbEncryptionInterceptorTestTable"
1515
encrypted_paginator_example(test_kms_key_id, test_dynamodb_table_name)

0 commit comments

Comments
 (0)