Commit 007a2ec4 authored by Adrien Dorsaz's avatar Adrien Dorsaz

acme-dns-tiny: fix the way to override ConfigParser values and add test in main…

acme-dns-tiny: fix the way to override ConfigParser values and add test in main process for the csr option
parent a601143b
......@@ -290,7 +290,7 @@ See example.ini file to configure correctly this script."""
config.read(args.configfile)
if args.csr :
config["acmednstiny"]["csrfile"] = args.csrfile
config.set("acmednstiny", "csrfile", args.csr)
if (set(["accountkeyfile", "csrfile", "acmedirectory", "checkchallengedelay"]) - set(config.options("acmednstiny"))
or set(["keyname", "keyvalue", "algorithm"]) - set(config.options("TSIGKeyring"))
......
......@@ -63,6 +63,19 @@ class TestACMEDNSTiny(unittest.TestCase):
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']])
certchain = sys.stdout.getvalue()
sys.stdout.close()
sys.stdout = old_stdout
self.assertCertificateChain(certchain)
def test_success_wild_cn(self):
""" Successfully issue a certificate via a wildcard common name """
old_stdout = sys.stdout
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment