diff -up tpm2-pytss-1.2.0/test/test_crypto.py.old tpm2-pytss-1.2.0/test/test_crypto.py --- tpm2-pytss-1.2.0/test/test_crypto.py.old 2022-10-17 15:26:41.205419193 +0200 +++ tpm2-pytss-1.2.0/test/test_crypto.py 2022-10-17 15:28:29.717379140 +0200 @@ -581,7 +581,7 @@ class CryptoTest(TSS2_EsapiTest): def test_ecc_bad_curves(self): with self.assertRaises(ValueError) as e: TPMT_PUBLIC.from_pem(ecc_bad_curve) - self.assertEqual(str(e.exception), "unsupported curve: sect163r2") + self.assertEqual(str(e.exception), "Unsupported key format") pub = TPMT_PUBLIC.from_pem(ecc_public_key) pub.parameters.eccDetail.curveID = TPM2_ECC.NONE diff -up tpm2-pytss-2.1.0/test/test_policy.py.old tpm2-pytss-2.1.0/test/test_policy.py --- tpm2-pytss-2.1.0/test/test_policy.py.old 2023-08-07 18:42:18.825991709 +0200 +++ tpm2-pytss-2.1.0/test/test_policy.py 2023-08-07 18:42:38.690410796 +0200 @@ -2,6 +2,7 @@ # SPDX-License-Identifier: BSD-2 import unittest +import pytest import textwrap import json from tpm2_pytss import * @@ -521,6 +522,7 @@ class TestPolicy(TSS2_EsapiTest): p.execute(self.ectx, session) self.assertEqual(str(e.exception), "callback exception") + @pytest.mark.skip(reason="Fedora does not support P192v1 curve") def test_exec_sign_callback(self): private_key = textwrap.dedent( """ @@ -593,6 +595,7 @@ class TestPolicy(TSS2_EsapiTest): p.execute(self.ectx, session) self.assertEqual(str(e.exception), "callback exception") + @pytest.mark.skip(reason="Fedora does not support P192v1 curve") def test_exec_polauth_callback(self): private_key = textwrap.dedent( """ From e4006e6066c015d9ed55befa9b98247fbdcafd7d Mon Sep 17 00:00:00 2001 From: Erik Larsson Date: Mon, 26 Jun 2023 12:15:41 +0200 Subject: [PATCH] test: add check for renamed cryptography types Some types have changed their names in newer cryptography release, so add them to the tests Signed-off-by: Erik Larsson --- test/test_crypto.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/test_crypto.py b/test/test_crypto.py index 92cda009..7d7466e2 100644 --- a/test/test_crypto.py +++ b/test/test_crypto.py @@ -596,11 +596,23 @@ def test_unsupported_key(self): with self.assertRaises(ValueError) as e: TPMT_SENSITIVE.from_pem(der) - self.assertEqual(str(e.exception), "unsupported key type: _DSAPrivateKey") + self.assertIn( + str(e.exception), + ( + "unsupported key type: _DSAPrivateKey", + "unsupported key type: DSAPrivateKey", + ), + ) with self.assertRaises(ValueError) as e: TPMT_PUBLIC.from_pem(dsa_public_key) - self.assertEqual(str(e.exception), "unsupported key type: _DSAPublicKey") + self.assertIn( + str(e.exception), + ( + "unsupported key type: _DSAPublicKey", + "unsupported key type: DSAPublicKey", + ), + ) def test_from_pem_with_symmetric(self): sym = TPMT_SYM_DEF_OBJECT(algorithm=TPM2_ALG.AES)