add tests for generate_data_key and generate_master_key
This commit is contained in:
parent
7eeead8a37
commit
3fe8afaa60
@ -6,11 +6,12 @@ from parameterized import parameterized
|
|||||||
from moto.kms.exceptions import AccessDeniedException, InvalidCiphertextException, NotFoundException
|
from moto.kms.exceptions import AccessDeniedException, InvalidCiphertextException, NotFoundException
|
||||||
from moto.kms.models import Key
|
from moto.kms.models import Key
|
||||||
from moto.kms.utils import (
|
from moto.kms.utils import (
|
||||||
|
_deserialize_ciphertext_blob,
|
||||||
|
_serialize_ciphertext_blob,
|
||||||
|
_serialize_encryption_context,
|
||||||
generate_data_key,
|
generate_data_key,
|
||||||
generate_master_key,
|
generate_master_key,
|
||||||
_serialize_ciphertext_blob,
|
MASTER_KEY_LEN,
|
||||||
_deserialize_ciphertext_blob,
|
|
||||||
_serialize_encryption_context,
|
|
||||||
encrypt,
|
encrypt,
|
||||||
decrypt,
|
decrypt,
|
||||||
Ciphertext,
|
Ciphertext,
|
||||||
@ -45,6 +46,20 @@ CIPHERTEXT_BLOB_VECTORS = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_generate_data_key():
|
||||||
|
test = generate_data_key(123)
|
||||||
|
|
||||||
|
test.should.be.a(bytes)
|
||||||
|
len(test).should.equal(123)
|
||||||
|
|
||||||
|
|
||||||
|
def test_generate_master_key():
|
||||||
|
test = generate_master_key()
|
||||||
|
|
||||||
|
test.should.be.a(bytes)
|
||||||
|
len(test).should.equal(MASTER_KEY_LEN)
|
||||||
|
|
||||||
|
|
||||||
@parameterized(ENCRYPTION_CONTEXT_VECTORS)
|
@parameterized(ENCRYPTION_CONTEXT_VECTORS)
|
||||||
def test_serialize_encryption_context(raw, serialized):
|
def test_serialize_encryption_context(raw, serialized):
|
||||||
test = _serialize_encryption_context(raw)
|
test = _serialize_encryption_context(raw)
|
||||||
|
Loading…
Reference in New Issue
Block a user