Ejemplo n.º 1
0
 def test_generate_root_certificate_unique_violate_name(self):
     cert = CertificateFactory()
     cert.type = CertificateTypes.ROOT
     cert.name = "repleo root ca 1"
     cert.save()
     cert = CertificateFactory()
     cert.type = CertificateTypes.ROOT
     cert.name = "repleo root ca 1"
     with self.assertRaises(ValidationError):
         cert.save()
Ejemplo n.º 2
0
 def test_parent_not_allowed_for_root_certificate(self):
     ca = CertificateFactory(type=CertificateTypes.ROOT)
     ca.save()
     cert = CertificateFactory(type=CertificateTypes.ROOT, parent=ca)
     cert.type = CertificateTypes.ROOT
     cert.name = "repleo root ca 1"
     with self.assertRaises(ValidationError) as c:
         cert.save()
     self.assertEqual(
         c.exception.message,
         "Not allowed to have a parent certificate for a Root CA certificate"
     )
Ejemplo n.º 3
0
 def test_generate_root_certificate_unique_violate_dn(self):
     dn_ca = DistinguishedNameFactory(
         countryName="NL",
         stateOrProvinceName="Noord-Holland",
         localityName="Amsterdam",
         organizationName="Repleo",
         organizationalUnitName="IT Department",
         emailAddress="*****@*****.**",
         commonName="test.bounca.org",
         subjectAltNames=["demo.bounca.org"],
     )
     cert = CertificateFactory()
     cert.dn = dn_ca
     cert.type = CertificateTypes.ROOT
     cert.name = "repleo root ca 1"
     cert.save()
     cert = CertificateFactory()
     cert.dn = dn_ca
     cert.type = CertificateTypes.ROOT
     cert.name = "repleo root ca 2"
     with self.assertRaises(ValidationError):
         cert.save()