@@ -100,11 +100,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest {
100
100
expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. keyProviderInfo. Some?;
101
101
expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. keyProviderInfo. value == "keyproviderInfo";
102
102
103
- expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. branchKeyId. Some?;
104
- expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. branchKeyVersion. Some?;
105
-
106
- expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. branchKeyId. value == "keyproviderInfo";
107
- expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. branchKeyVersion. value == "155b7a3d- 7625- 4826- 4302- 113d1179075a";
103
+ assertBranchKey (actualDataKeyDescription);
108
104
}
109
105
110
106
method {:test} TestHeaderInputRawRsaDataKeyDataKeyCase ()
@@ -177,11 +173,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest {
177
173
expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. keyProviderInfo. Some?;
178
174
expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. keyProviderInfo. value == "keyproviderInfo";
179
175
180
- expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. branchKeyId. Some?;
181
- expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. branchKeyVersion. Some?;
182
-
183
- expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. branchKeyId. value == "keyproviderInfo";
184
- expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. branchKeyVersion. value == "155b7a3d- 7625- 4826- 4302- 113d1179075a";
176
+ assertBranchKey (actualDataKeyDescription);
185
177
}
186
178
187
179
method {:test} TestDDBItemInputRawRsaDataKeyCase ()
@@ -268,7 +260,7 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest {
268
260
269
261
method {:test} TestNoHeaderFailureCase ()
270
262
{
271
- var expectedHead := CreatePartialHeader (testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey, testAwsKmsRsaDataKey ]);
263
+ var expectedHead := CreatePartialHeader (testVersion, testFlavor1, testMsgID, testLegend, testEncContext, [testAwsKmsDataKey]);
272
264
var serializedHeader := expectedHead. serialize () + expectedHead. msgID;
273
265
var attr := map ["wrong_header_attribute" := ComAmazonawsDynamodbTypes. AttributeValue. B (serializedHeader)];
274
266
var ddbEncResources :- expect DynamoDbEncryption. DynamoDbEncryption ();
@@ -282,4 +274,14 @@ module DynamoDbGetEncryptedDataKeyDescriptionTest {
282
274
expect actualDataKeyDescription. error. DynamoDbEncryptionException?;
283
275
expect actualDataKeyDescription. error. message == "Header not found in the DynamoDB item. ";
284
276
}
277
+
278
+ method assertBranchKey (actualDataKeyDescription : Types .GetEncryptedDataKeyDescriptionOutput)
279
+ {
280
+ expect |actualDataKeyDescription. EncryptedDataKeyDescriptionOutput| == 1;
281
+ expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. branchKeyId. Some?;
282
+ expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. branchKeyVersion. Some?;
283
+
284
+ expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. branchKeyId. value == "keyproviderInfo";
285
+ expect actualDataKeyDescription. EncryptedDataKeyDescriptionOutput[0]. branchKeyVersion. value == "155b7a3d- 7625- 4826- 4302- 113d1179075a";
286
+ }
285
287
}
0 commit comments