def setUp(self):
        from letsencrypt.client.revoker import Cert
        base_package = "letsencrypt.client.tests"
        self.cert0 = Cert(
            pkg_resources.resource_filename(
                base_package, os.path.join("testdata", "cert.pem")))
        self.cert1 = Cert(
            pkg_resources.resource_filename(
                base_package, os.path.join("testdata", "cert-san.pem")))

        self.certs = [self.cert0, self.cert1]

        zope.component.provideUtility(display_util.FileDisplay(sys.stdout))
    def test_remove_certs_from_list_bad_certs(self):
        # pylint: disable=protected-access
        from letsencrypt.client.revoker import Cert

        new_cert = Cert(self.paths[0])

        # This isn't stored in the db
        new_cert.idx = 10
        new_cert.backup_path = self.paths[0]
        new_cert.backup_key_path = self.key_path
        new_cert.orig = Cert.PathStatus("false path", "not here")
        new_cert.orig_key = Cert.PathStatus("false path", "not here")

        self.assertRaises(errors.LetsEncryptRevokerError,
                          self.revoker._remove_certs_from_list, [new_cert])
def create_revoker_certs():
    """Create a few revoker.Cert objects."""
    from letsencrypt.client.revoker import Cert

    base_package = "letsencrypt.client.tests"

    cert0_path = pkg_resources.resource_filename(
        base_package, os.path.join("testdata", "cert.pem"))

    cert1_path = pkg_resources.resource_filename(
        base_package, os.path.join("testdata", "cert-san.pem"))

    cert0 = Cert(cert0_path)
    cert1 = Cert(cert1_path)

    key_path = pkg_resources.resource_filename(
        base_package, os.path.join("testdata", "rsa512_key.pem"))

    return [cert0_path, cert1_path], [cert0, cert1], key_path
    def test_remove_certs_from_list_bad_certs(self):
        # pylint: disable=protected-access
        from letsencrypt.client.revoker import Cert

        new_cert = Cert(self.paths[0])

        # This isn't stored in the db
        new_cert.idx = 10
        new_cert.backup_path = self.paths[0]
        new_cert.backup_key_path = self.key_path
        new_cert.orig = Cert.PathStatus("false path", "not here")
        new_cert.orig_key = Cert.PathStatus("false path", "not here")

        self.assertRaises(errors.LetsEncryptRevokerError,
                          self.revoker._remove_certs_from_list,
                          [new_cert])
 def setUp(self):
     from letsencrypt.client.revoker import Cert
     self.cert = Cert(
         pkg_resources.resource_filename(
             "letsencrypt.client.tests",
             os.path.join("testdata", "cert.pem")))