def setUpClass(self):
        self.configs = generate_acme_account_deactivate_config()
        try:
            acme_dns_tiny.main([self.configs['config']])
        except ValueError as err:
            if str(err).startswith("Error register"):
                raise ValueError(
                    "Fail test as account has not been registered correctly: {0}"
                    .format(err))

        super(TestACMEAccountDeactivate, self).setUpClass()
    def test_success_wild_cn(self):
        """ Successfully issue a certificate via a wildcard common name """
        old_stdout = sys.stdout
        sys.stdout = StringIO()

        acme_dns_tiny.main([self.configs['wildCName'], "--verbose"])
        certchain = sys.stdout.getvalue()

        sys.stdout.close()
        sys.stdout = old_stdout

        self.assertCertificateChain(certchain)
    def test_success_wildsan(self):
        """ Successfully issue a certificate via wildcard in subject alt name """
        old_stdout = sys.stdout
        sys.stdout = StringIO()

        acme_dns_tiny.main([self.configs['wildSAN']])
        certchain = sys.stdout.getvalue()

        sys.stdout.close()
        sys.stdout = old_stdout

        self.assertCertificateChain(certchain)
    def test_success_cn_with_csr_option(self):
        """ Successfully issue a certificate using CSR option outside from the config file"""
        old_stdout = sys.stdout
        sys.stdout = StringIO()

        acme_dns_tiny.main([
            "--csr", self.configs['cnameCSR'],
            self.configs['goodCNameWithoutCSR'], "--verbose"
        ])
        certchain = sys.stdout.getvalue()

        sys.stdout.close()
        sys.stdout = old_stdout

        self.assertCertificateChain(certchain)
    def test_success_dnshost_ip(self):
        """ When DNS Host is an IP, DNS resolution have to fail without error """
        old_stdout = sys.stdout
        sys.stdout = StringIO()

        with self.assertLogs(level='INFO') as adnslog:
            acme_dns_tiny.main([self.configs['dnsHostIP'], "--verbose"])
        self.assertIn(
            "INFO:acme_dns_tiny:A and/or AAAA DNS resources not found for configured dns host: we will use either resource found if one exists or directly the DNS Host configuration.",
            adnslog.output)
        certchain = sys.stdout.getvalue()

        sys.stdout.close()
        sys.stdout = old_stdout

        self.assertCertificateChain(certchain)
Beispiel #6
0
 def setUpClass(self):
     self.configs = generate_acme_account_rollover_config()
     acme_dns_tiny.main([self.configs['config']])
     super(TestACMEAccountRollover, self).setUpClass()