From 9fbb889347696db4a15e44b2c73d38aa47da8b97 Mon Sep 17 00:00:00 2001 From: Phoebe Queen Date: Wed, 12 Aug 2015 03:51:33 +0100 Subject: added test for get_extension_for_class --- tests/test_x509_ext.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index 2c5438a9..a05dc2a4 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -832,6 +832,16 @@ class TestExtensions(object): extensions = cert.extensions assert len(extensions) == 0 + def test_one_extension_get_for_class(self, backend): + cert = _load_cert( + os.path.join("x509", "custom", "basic_constraints_not_critical.pem"), + x509.load_pem_x509_certificate, + backend + ) + ext = cert.extensions.get_extension_for_class(x509.BasicConstraints) + assert ext is not None + + assert isinstance(ext.value, x509.BasicConstraints) @pytest.mark.requires_backend_interface(interface=RSABackend) @pytest.mark.requires_backend_interface(interface=X509Backend) -- cgit v1.2.3