@@ -399,7 +399,8 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
399
399
BasicIoTestTransactWriteItems (c1, c2, globalRecords);
400
400
BasicIoTestUpdateItem (c1, c2, globalRecords, "One");
401
401
BasicIoTestUpdateItem (c1, c2, globalRecords, "Two");
402
- BasicIoTestDeleteItem (c1, c2, globalRecords);
402
+ BasicIoTestDeleteItem (c1, c2, globalRecords, "One", "Uno");
403
+ BasicIoTestDeleteItem (c1, c2, globalRecords, "Two", "Dos");
403
404
BasicIoTestExecuteStatement (c1, c2);
404
405
BasicIoTestExecuteTransaction (c1, c2);
405
406
BasicIoTestBatchExecuteStatement (c1, c2);
@@ -849,9 +850,7 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
849
850
850
851
method BasicIoTestUpdateItem (writeConfig : TableConfig , readConfig : TableConfig , records : seq <Record >, attributeToUpdate: DDB .AttributeName)
851
852
{
852
- var wClient :- expect newGazelle (writeConfig);
853
- var rClient :- expect newGazelle (readConfig);
854
- DeleteTable (wClient);
853
+ var wClient, rClient := SetupTestTable (writeConfig, readConfig);
855
854
WriteAllRecords (wClient, records);
856
855
857
856
// Update each record by appending "updated" to the partition key
@@ -889,21 +888,19 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
889
888
}
890
889
}
891
890
892
- method BasicIoTestDeleteItem (writeConfig : TableConfig , readConfig : TableConfig , records : seq <Record >)
891
+ method BasicIoTestDeleteItem (writeConfig : TableConfig , readConfig : TableConfig , records : seq <Record >, attributeToDelete: DDB .AttributeName, expectedAttributeValue: string )
893
892
{
894
- var wClient :- expect newGazelle (writeConfig);
895
- var rClient :- expect newGazelle (readConfig);
896
- DeleteTable (wClient);
893
+ var wClient, rClient := SetupTestTable (writeConfig, readConfig);
897
894
WriteAllRecords (wClient, records);
898
- var attributeToDelete := "Two";
899
- var valueToDelete := "Dos";
895
+ // var attributeToDelete := "Two";
896
+ // var valueToDelete := "Dos";
900
897
// Try to delete records with a condition expression with condition to
901
- // delete records if the record has an attribute attributeToDelete with value valueToDelete
898
+ // delete records if the record has an attribute attributeToDelete with value expectedAttributeValue
902
899
for i := 0 to |records| {
903
- // Set up condition expression to only delete if Two = valueToDelete
900
+ // Set up condition expression to only delete if Two = expectedAttributeValue
904
901
var conditionExpr := "#attr = :val";
905
902
var exprAttrNames := map ["#attr" := attributeToDelete];
906
- var exprAttrValues := map [":val" := DDB. AttributeValue. S (valueToDelete )];
903
+ var exprAttrValues := map [":val" := DDB. AttributeValue. S (expectedAttributeValue )];
907
904
expect HashName in records[i]. item, "`HashName` is not in records. ";
908
905
var deleteInput := DDB. DeleteItemInput (
909
906
TableName := TableName,
@@ -926,7 +923,7 @@ module {:options "-functionSyntax:4"} DdbEncryptionTestVectors {
926
923
expect deleteResult. error. OpaqueWithText?, "Error should have been of type OpaqueWithText";
927
924
var hasDynamoDbEncryptionTransformsException? := String. HasSubString (deleteResult.error.objMessage, "Condition Expressions forbidden on encrypted attributes");
928
925
expect hasDynamoDbEncryptionTransformsException?. Some?, "Error might is not be of type DynamoDbEncryptionTransformsException";
929
- } else if attributeToDelete in records[i]. item && records[i]. item[attributeToDelete]. S? && records[i]. item[attributeToDelete]. S == valueToDelete {
926
+ } else if attributeToDelete in records[i]. item && records[i]. item[attributeToDelete]. S? && records[i]. item[attributeToDelete]. S == expectedAttributeValue {
930
927
expect deleteResult. Success?, "DeleteItem should have failed. ";
931
928
expect deleteResult. value. Attributes. Some?, "DeleteItemOutput should have had some attribute because ReturnValues was set as `ALL_OLD` in DeleteItemInput";
932
929
expect deleteResult. value. Attributes. value == records[i]. item, "Wrong item was deleted. ";
0 commit comments