Skip to content

Commit bb5e192

Browse files
author
Lucas McDonald
committed
sync
1 parent b9ce29b commit bb5e192

File tree

5 files changed

+14
-21
lines changed

5 files changed

+14
-21
lines changed

DynamoDbEncryption/runtimes/python/test/integ/encrypted/test_item.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
from ...items import complex_item_ddb, complex_item_dict, simple_item_ddb, simple_item_dict
1414

1515

16-
# Creates a matrix
16+
# Creates a matrix of tests for each value in param,
17+
# with a user-friendly string for test output:
18+
# use_complex_item = True -> "complex_item"
19+
# use_complex_item = False -> "simple_item"
1720
@pytest.fixture(params=[True, False], ids=["complex_item", "simple_item"])
1821
def use_complex_item(request):
1922
return request.param

Examples/runtimes/python/DynamoDBEncryption/src/item_encryptor/encrypt_decrypt_example.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
13
"""
24
Set up an ItemEncryptor and use its APIs to encrypt and decrypt items in 3 different formats.
35
@@ -45,7 +47,7 @@ def encrypt_decrypt_example(kms_key_id: str, ddb_table_name: str) -> None:
4547
"""Encrypt and decrypt an item with an ItemEncryptor."""
4648
# 1. Create a Keyring. This Keyring will be responsible for protecting the data keys that protect your data.
4749
# For this example, we will create a AWS KMS Keyring with the AWS KMS Key we want to use.
48-
# We will use the `CreateMrkMultiKeyring` method to create this keyring,
50+
# We will use the `CreateAwsKmsMrkMultiKeyringInput` method to create this keyring,
4951
# as it will correctly handle both single region and Multi-Region KMS Keys.
5052
mat_prov: AwsCryptographicMaterialProviders = AwsCryptographicMaterialProviders(config=MaterialProvidersConfig())
5153
kms_mrk_multi_keyring_input: CreateAwsKmsMrkMultiKeyringInput = CreateAwsKmsMrkMultiKeyringInput(
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
3-
"""Test suite for the EncryptedClient example."""
3+
"""Test suite for the ItemEncryptor example."""
44
import pytest
55

66
from ...src.item_encryptor.encrypt_decrypt_example import encrypt_decrypt_example
@@ -9,7 +9,7 @@
99

1010

1111
def test_encrypt_decrypt_example():
12-
"""Test function for encrypt and decrypt using the EncryptedClient example."""
12+
"""Test function for encrypt and decrypt using the ItemEncryptor 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
encrypt_decrypt_example(test_kms_key_id, test_dynamodb_table_name)

TestVectors/runtimes/python/src/aws_dbesdk_dynamodb_test_vectors/internaldafny/extern/CreateWrappedDictItemEncryptor.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
1-
import boto3
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
23
import aws_dbesdk_dynamodb_test_vectors.internaldafny.generated.CreateWrappedItemEncryptor
34
from aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.dafny_to_smithy import aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor_DynamoDbItemEncryptorConfig
45
from aws_dbesdk_dynamodb.encrypted.item import ItemEncryptor
56
from smithy_dafny_standard_library.internaldafny.generated import Wrappers
67
from aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.errors import _smithy_error_to_dafny_error
78
from aws_dbesdk_dynamodb_test_vectors.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.shim import DynamoDbItemEncryptorShim
89
from aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.models import (
9-
DecryptItemInput,
1010
DecryptItemOutput,
11-
EncryptItemInput,
1211
EncryptItemOutput,
1312
)
14-
from aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.smithy_to_dafny import (
15-
aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor_EncryptItemOutput as SmithyToDafnyEncryptItemOutput,
16-
aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor_DecryptItemOutput as SmithyToDafnyDecryptItemOutput,
17-
)
18-
from aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.dafny_to_smithy import (
19-
aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor_EncryptItemInput as DafnyToSmithyEncryptItemInput,
20-
aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor_DecryptItemInput as DafnyToSmithyDecryptItemInput,
21-
)
2213
from aws_dbesdk_dynamodb.transform import (
2314
dict_to_ddb,
2415
ddb_to_dict,
@@ -32,6 +23,7 @@ class DynamoDBFormatToDictFormatWrapper:
3223
However, the legacy Python DDBEC ItemEncryptor also supports Python dictionary-formatted items.
3324
This class transforms Dafny TestVectors' DynamoDB-formatted items
3425
to Python DBESDK's ItemEncryptor's Python dictionary-formatted encryption methods.
26+
This improves the test coverage of the ItemEncryptor.
3527
"""
3628
def __init__(self, item_encryptor):
3729
self._item_encryptor = item_encryptor

TestVectors/runtimes/python/src/aws_dbesdk_dynamodb_test_vectors/internaldafny/extern/CreateWrappedDynamoDbItemEncryptor.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
import boto3
1+
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2+
# SPDX-License-Identifier: Apache-2.0
23
import aws_dbesdk_dynamodb_test_vectors.internaldafny.generated.CreateWrappedItemEncryptor
34
from aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.dafny_to_smithy import aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor_DynamoDbItemEncryptorConfig
45
from aws_dbesdk_dynamodb.encrypted.item import ItemEncryptor
56
from smithy_dafny_standard_library.internaldafny.generated import Wrappers
67
from aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.errors import _smithy_error_to_dafny_error
78
from aws_dbesdk_dynamodb_test_vectors.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.shim import DynamoDbItemEncryptorShim
8-
from aws_dbesdk_dynamodb.smithygenerated.aws_cryptography_dbencryptionsdk_dynamodb_itemencryptor.models import (
9-
DecryptItemInput,
10-
EncryptItemInput,
11-
)
129

13-
# In contrast to
1410

1511
class default__:
1612
@staticmethod

0 commit comments

Comments
 (0)