aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cryptography/x509.py6
-rw-r--r--tests/test_x509.py7
-rw-r--r--tox.ini2
3 files changed, 15 insertions, 0 deletions
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 "<NameAttribute(oid={oid}, value={value!r})>".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) == (
+ "<NameAttribute(oid=<ObjectIdentifier(oid=2.5.4.3, name=commonName"
+ ")>, value='value')>"
+ )
+
class TestObjectIdentifier(object):
def test_eq(self):
diff --git a/tox.ini b/tox.ini
index 4e1304d8..dc8811af 100644
--- a/tox.ini
+++ b/tox.ini
@@ -21,6 +21,7 @@ commands =
deps =
doc8
pyenchant
+ readme>=0.5.1
sphinx
sphinx_rtd_theme
sphinxcontrib-spelling
@@ -31,6 +32,7 @@ commands =
sphinx-build -W -b doctest -d {envtmpdir}/doctrees docs docs/_build/html
sphinx-build -W -b spelling docs docs/_build/html
doc8 --allow-long-titles README.rst CHANGELOG.rst docs/ --ignore-path docs/_build/
+ python setup.py check --restructuredtext --strict
[testenv:docs-linkcheck]
deps =