def test_days_valid(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(dn=dn_ca, type=CertificateTypes.ROOT) cert.expires_at = arrow.get(timezone.now()).shift(years=+10).date() self.assertEqual(cert.days_valid, 3652) cert.save() cert.refresh_from_db() self.assertEqual(cert.days_valid, 3652)
def test_set_name_to_common_name(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(name="", dn=dn_ca, type=CertificateTypes.ROOT) cert.save() cert.refresh_from_db() self.assertEqual(cert.name, cert.dn.commonName) self.assertEqual(cert.slug_name, "testbouncaorg")