def test_with_duplicates(self):
     csr = signing_request.X509Csr()
     ext = extension.X509ExtensionSubjectAltName()
     ext.add_dns_id('example.com')
     exts = rfc5280.Extensions()
     exts[0] = ext._ext
     exts[1] = ext._ext
     # Anchor doesn't allow this normally, so tests need to cheat
     attrs = csr.get_attributes()
     attrs[0] = None
     attrs[0]['attrType'] = signing_request.OID_extensionRequest
     attrs[0]['attrValues'] = None
     attrs[0]['attrValues'][0] = encoder.encode(exts)
     with self.assertRaises(errors.ValidationError):
         standards._no_extension_duplicates(csr)
 def test_no_duplicates(self):
     csr = signing_request.X509Csr()
     ext = extension.X509ExtensionSubjectAltName()
     csr.add_extension(ext)
     standards._no_extension_duplicates(csr)
 def test_no_extensions(self):
     csr = signing_request.X509Csr()
     standards._no_extension_duplicates(csr)