Skip to content

Commit c5da3a4

Browse files
author
Lucas McDonald
committed
m
1 parent 6a99328 commit c5da3a4

File tree

1 file changed

+35
-0
lines changed
  • DynamoDbEncryption/runtimes/python/test/unit/internal

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
The test_client_to_resource.py and test_resource_to_client.py files
2+
in this directory verify that DBESDK's boto3 resource/client conversion methods
3+
correctly convert between resource/client shapes for all operations
4+
supported by DBESDK.
5+
6+
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)
11+
* Client shape ex.:
12+
* KeyConditionExpression: `"attr : :value"`
13+
* ExpressionAttributeValues: `{":value" : {"S" : "some value}}`
14+
* Resource shape ex.:
15+
* KeyConditionExpression: `Attr("attr").eq("some value")` (also supports the client shape)
16+
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:
20+
* `["Item"]`
21+
* `["Expected"][<table_name>]["Value"]`
22+
* `["Expected"][<table_name>]["AttributeValueList"]`
23+
* `["ConditionExpression"]`
24+
* `["ExpressionAttributeValues"]`
25+
26+
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
29+
30+
Note: The conversion logic is generated by Smithy-Dafny Python
31+
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.

0 commit comments

Comments
 (0)