@@ -215,13 +215,32 @@ def test_immutable_keyring_trace(material_class):
215
215
materials .keyring_trace .append (42 )
216
216
217
217
218
+ @pytest .mark .parametrize ("material_class" , (CryptographicMaterials , EncryptionMaterials , DecryptionMaterials ))
219
+ def test_empty_keyring_trace (material_class ):
220
+ materials = material_class (** _copy_and_update_kwargs (material_class .__name__ , dict (keyring_trace = _REMOVE )))
221
+
222
+ trace = materials .keyring_trace
223
+
224
+ assert isinstance (trace , tuple )
225
+ assert not trace
226
+
227
+
218
228
def test_immutable_encrypted_data_keys ():
219
229
materials = EncryptionMaterials (** _VALID_KWARGS ["EncryptionMaterials" ])
220
230
221
231
with pytest .raises (AttributeError ):
222
232
materials .encrypted_data_keys .add (42 )
223
233
224
234
235
+ def test_empty_encrypted_data_keys ():
236
+ materials = EncryptionMaterials (** _copy_and_update_kwargs ("EncryptionMaterials" , dict (encrypted_data_keys = _REMOVE )))
237
+
238
+ edks = materials .encrypted_data_keys
239
+
240
+ assert isinstance (edks , frozenset )
241
+ assert not edks
242
+
243
+
225
244
@pytest .mark .parametrize (
226
245
"material_class, flag" ,
227
246
(
@@ -415,3 +434,46 @@ def test_add_verification_key_fail(mod_kwargs, verification_key, exception_type,
415
434
materials .add_verification_key (verification_key = verification_key )
416
435
417
436
excinfo .match (exception_message )
437
+
438
+
439
+ def test_decryption_materials_is_complete ():
440
+ materials = DecryptionMaterials (** _copy_and_update_kwargs ("DecryptionMaterials" , {}))
441
+
442
+ assert materials .is_complete
443
+
444
+
445
+ @pytest .mark .parametrize (
446
+ "mod_kwargs" ,
447
+ (
448
+ dict (algorithm = _REMOVE ),
449
+ dict (encryption_context = _REMOVE ),
450
+ dict (data_encryption_key = _REMOVE , data_key = _REMOVE ),
451
+ dict (verification_key = _REMOVE ),
452
+ ),
453
+ )
454
+ def test_decryption_materials_is_not_complete (mod_kwargs ):
455
+ kwargs = _copy_and_update_kwargs ("DecryptionMaterials" , mod_kwargs )
456
+ materials = DecryptionMaterials (** kwargs )
457
+
458
+ assert not materials .is_complete
459
+
460
+
461
+ def test_encryption_materials_is_complete ():
462
+ materials = EncryptionMaterials (** _copy_and_update_kwargs ("EncryptionMaterials" , {}))
463
+
464
+ assert materials .is_complete
465
+
466
+
467
+ @pytest .mark .parametrize (
468
+ "mod_kwargs" ,
469
+ (
470
+ dict (data_encryption_key = _REMOVE , encrypted_data_keys = _REMOVE ),
471
+ dict (encrypted_data_keys = _REMOVE ),
472
+ dict (signing_key = _REMOVE ),
473
+ ),
474
+ )
475
+ def test_encryption_materials_is_not_complete (mod_kwargs ):
476
+ kwargs = _copy_and_update_kwargs ("EncryptionMaterials" , mod_kwargs )
477
+ materials = EncryptionMaterials (** kwargs )
478
+
479
+ assert not materials .is_complete
0 commit comments