add tests for generate_data_key and generate_master_key

This commit is contained in:
mattsb42-aws 2019-08-26 23:29:30 -07:00
parent 7eeead8a37
commit 3fe8afaa60

View File

@ -6,11 +6,12 @@ from parameterized import parameterized
from moto.kms.exceptions import AccessDeniedException, InvalidCiphertextException, NotFoundException
from moto.kms.models import Key
from moto.kms.utils import (
_deserialize_ciphertext_blob,
_serialize_ciphertext_blob,
_serialize_encryption_context,
generate_data_key,
generate_master_key,
_serialize_ciphertext_blob,
_deserialize_ciphertext_blob,
_serialize_encryption_context,
MASTER_KEY_LEN,
encrypt,
decrypt,
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)
def test_serialize_encryption_context(raw, serialized):
test = _serialize_encryption_context(raw)