def create_cert(self, common_name, modhash, key, csr, crt, bug, sans=None, expiry=None, authority=None, destinations=None): cert = Cert( common_name, self.timestamp, modhash, key, csr, crt, bug, sans, expiry=expiry, authority=authority, destinations=destinations) cert.save(self.tarpath) return cert
def wildcard_cert(): return Cert('*.common.name', 20170209155541, 'e8a7fcfbe48df21daede665d78984dec', KEY, CSR, CRT, '0000000', expiry=20170401000000, authority=dict(digicert=dict(order_id=1298368)))
def load_cert(self, cert_name): cert = Cert.load(self.tarpath, cert_name) return cert
def test_json_roundtrip(cert): json = cert.to_json() cert2 = Cert.from_json(json) assert cert == cert2
def test_disk_roundtrip(cert, tmpdir, capsys): tarpath = tmpdir.mkdir('tarpath') tarfile = cert.save(tarpath) cert2 = Cert.load(tarpath, cert.cert_name) assert cert == cert2