Skip to content

Commit 5c4a89e

Browse files
author
Lucas McDonald
committed
m
1 parent c5da3a4 commit 5c4a89e

File tree

1 file changed

+19
-15
lines changed
  • DynamoDbEncryption/runtimes/python/test/unit/internal

1 file changed

+19
-15
lines changed
Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,39 @@
1-
The test_client_to_resource.py and test_resource_to_client.py files
1+
The `test_client_to_resource.py` and `test_resource_to_client.py` files
22
in this directory verify that DBESDK's boto3 resource/client conversion methods
33
correctly convert between resource/client shapes for all operations
44
supported by DBESDK.
55

66
The only shapes that require conversion are
7-
* AttributeValues (DDB items or keys)
8-
* Client shape ex.: `{"S": "some string"}`
9-
* Resource shape ex.: `"some string"`
10-
* ConditionExpressions (KeyConditionExpression or FilterExpression; only resource-to-client)
7+
* `AttributeValue`s (DDB items or keys)
8+
* Client format example: `{"S": "some string"}`
9+
* Resource format example: `"some string"`
10+
* ConditionExpressions (`KeyConditionExpression` or `FilterExpression`; only resource-to-client)
1111
* Client shape ex.:
1212
* KeyConditionExpression: `"attr : :value"`
1313
* ExpressionAttributeValues: `{":value" : {"S" : "some value}}`
1414
* Resource shape ex.:
15-
* KeyConditionExpression: `Attr("attr").eq("some value")` (also supports the client shape)
15+
* KeyConditionExpression: `Attr("attr").eq("some value")`
16+
* (Resources also support the client-style string expression)
1617

17-
and recursive traversals from the input/output shape to those shapes.
18-
(i.e. for boto3 Table [put_item](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/put_item.html)),
19-
the following kwargs MUST be converted from resource shapes to client shapes:
18+
The conversion logic will recursively traverse inpuyt/output shapes to find shapes that require conversion, then convert them.
19+
(ex. for boto3 Table [put_item](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/table/put_item.html)),
20+
the following kwargs MUST be converted from resource to client format:
2021
* `["Item"]`
2122
* `["Expected"][<table_name>]["Value"]`
2223
* `["Expected"][<table_name>]["AttributeValueList"]`
2324
* `["ConditionExpression"]`
2425
* `["ExpressionAttributeValues"]`
2526

2627
The requests, responses, and items in the parent directory are shared between the integ tests and these unit tests.
27-
The integ tests assert that the basic forms of these requests, responses, and items are authoritative; i.e. DynamoDB will receive/send these structures.
28-
These tests assert
28+
The integ tests send the exact request that whose client/resource conversion is tested in the unit tests,
29+
and the integ tests receive the exact response whose conversion is tested in the unit tests.
30+
31+
The integration tests verify that the basic forms of these requests and responses are authoritative. The unit tests verify that DBESDK’s conversion logic exactly transforms one shape format into the other.
2932

3033
Note: The conversion logic is generated by Smithy-Dafny Python
3134
and the shape traversals are derived from the MPL's DynamoDB Smithy model.
32-
As a result, the correctness of this conversion logic is largely defined by the correctness of the Smithy codegen logic and the correctness of the DynamoDB Smithy model.
33-
As a result, the amount of testing needed by these files *should* only need to be smoke testing,
34-
but it is more exhaustive than that
35-
because the conversion logic was manually written at first.
35+
As a result, the correctness of this conversion logic is primarily depends on the correctness of the Smithy codegen logic and the correctness of the DynamoDB Smithy model.
36+
37+
Originally, the conversion logic was hand-written,
38+
so these tests go beyond smoke testing to provide extra guarantees,
39+
even though basic smoke testing should suffice now that the logic is machine-generated.

0 commit comments

Comments
 (0)