From 23d10c3bda214161e3f9d02fe2ef11314ea431c7 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 2 Apr 2015 23:12:32 -0500 Subject: add extendedkeyusage repr --- src/cryptography/x509.py | 3 +++ tests/test_x509_ext.py | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py index 63c8767d..4de7428f 100644 --- a/src/cryptography/x509.py +++ b/src/cryptography/x509.py @@ -238,6 +238,9 @@ class ExtendedKeyUsage(object): def __len__(self): return len(self._usages) + def __repr__(self): + return "".format(self._usages) + class BasicConstraints(object): def __init__(self, ca, path_length): diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index 7447ac4b..c1512d5f 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -175,6 +175,17 @@ class TestExtendedKeyUsage(object): x509.OID_CLIENT_AUTH ] + def test_repr(self): + eku = x509.ExtendedKeyUsage([ + x509.ObjectIdentifier("1.3.6.1.5.5.7.3.1"), + x509.ObjectIdentifier("1.3.6.1.5.5.7.3.2"), + ]) + assert repr(eku) == ( + ", ])>" + ) + @pytest.mark.requires_backend_interface(interface=RSABackend) @pytest.mark.requires_backend_interface(interface=X509Backend) -- cgit v1.2.3