File tree Expand file tree Collapse file tree
tests/test_paymentcryptography Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010from cryptography .hazmat .primitives .ciphers .algorithms import AES
1111
1212from moto import mock_aws
13- from moto .core import DEFAULT_ACCOUNT_ID
14- from moto .paymentcryptography .models import (
15- PaymentCryptographyControlPlaneBackend ,
16- paymentcryptography_backends ,
17- )
13+ from moto .paymentcryptography .models import PaymentCryptographyControlPlaneBackend
1814from moto .paymentcryptography .responses import PaymentCryptographyControlPlaneResponse
1915
2016ATTRIBUTES = {
@@ -235,13 +231,14 @@ def test_import_export_certificates_and_token_reuse():
235231
236232
237233@mock_aws
238- def test_kcv_matches_aes_cmac ():
234+ def test_kcv_matches_aes_cmac (monkeypatch ):
235+ material = bytes (range (16 ))
236+ monkeypatch .setattr (
237+ "moto.paymentcryptography.models.os.urandom" , lambda size : material [:size ]
238+ )
239239 pc = client ()
240240 key = pc .create_key (KeyAttributes = ATTRIBUTES , Exportable = True )["Key" ]
241- backend_key = paymentcryptography_backends [DEFAULT_ACCOUNT_ID ]["us-east-1" ].keys [
242- key ["KeyArn" ]
243- ]
244- calculator = cmac .CMAC (AES (backend_key .material ))
241+ calculator = cmac .CMAC (AES (material ))
245242 calculator .update (bytes (16 ))
246243 assert key ["KeyCheckValue" ] == calculator .finalize ()[:3 ].hex ().upper ()
247244
You can’t perform that action at this time.
0 commit comments