From a498be81b54f8e4a9b07a71aabc434e372c309a6 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 12 Feb 2015 15:00:56 -0600 Subject: add repr for x509.NameAttribute --- src/cryptography/x509.py | 6 ++++++ tests/test_x509.py | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py index e280980b..71062588 100644 --- a/src/cryptography/x509.py +++ b/src/cryptography/x509.py @@ -75,6 +75,12 @@ class NameAttribute(object): def __ne__(self, other): return not self == other + def __repr__(self): + return "".format( + oid=self.oid, + value=self.value + ) + class ObjectIdentifier(object): def __init__(self, dotted_string): diff --git a/tests/test_x509.py b/tests/test_x509.py index 38231205..09275207 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -277,6 +277,13 @@ class TestNameAttribute(object): x509.ObjectIdentifier('oid'), 'value' ) != object() + def test_repr(self): + na = x509.NameAttribute(x509.ObjectIdentifier('2.5.4.3'), 'value') + assert repr(na) == ( + ", value='value')>" + ) + class TestObjectIdentifier(object): def test_eq(self): -- cgit v1.2.3