618
618
name, type(name), X509NameType))
621
def test_onlyStringAttributes(self):
623
Attempting to set a non-L{str} attribute name on an L{X509NameType}
624
instance causes L{TypeError} to be raised.
626
name = self._x509name()
627
# Beyond these cases, you may also think that unicode should be
628
# rejected. Sorry, you're wrong. unicode is automatically converted to
629
# str outside of the control of X509Name, so there's no way to reject
631
self.assertRaises(TypeError, setattr, name, None, "hello")
632
self.assertRaises(TypeError, setattr, name, 30, "hello")
635
self.assertRaises(TypeError, setattr, name, evil(), "hello")
638
def test_setInvalidAttribute(self):
640
Attempting to set any attribute name on an L{X509NameType} instance for
641
which no corresponding NID is defined causes L{AttributeError} to be
644
name = self._x509name()
645
self.assertRaises(AttributeError, setattr, name, "no such thing", None)
621
648
def test_attributes(self):
623
650
L{X509NameType} instances have attributes for each standard (?)