diff options
Diffstat (limited to 'tests/hazmat/backends/test_openssl.py')
-rw-r--r-- | tests/hazmat/backends/test_openssl.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index 38f11347..4ec8d84e 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -728,10 +728,18 @@ class TestGOSTCertificate(object): x509.load_der_x509_certificate, backend ) - with pytest.raises(ValueError) as exc: - cert.subject - - # We assert on the message in this case because if the certificate - # fails to load it will also raise a ValueError and this test could - # erroneously pass. - assert str(exc.value) == "Unsupported ASN1 string type. Type: 18" + if ( + not backend._lib.CRYPTOGRAPHY_OPENSSL_110_OR_GREATER or + backend._lib.CRYPTOGRAPHY_IS_LIBRESSL + ): + with pytest.raises(ValueError) as exc: + cert.subject + + # We assert on the message in this case because if the certificate + # fails to load it will also raise a ValueError and this test could + # erroneously pass. + assert str(exc.value) == "Unsupported ASN1 string type. Type: 18" + else: + assert cert.subject.get_attributes_for_oid( + x509.ObjectIdentifier("1.2.643.3.131.1.1") + )[0].value == "007710474375" |