Commit a153485c authored by Adrien Dorsaz's avatar Adrien Dorsaz

add unit test to check Contacts option is facultative

parent 36aee137
Pipeline #228 failed with stage
in 0 seconds
......@@ -58,6 +58,16 @@ def generate_acme_dns_tiny_config():
with open(goodCName.name, 'w') as configfile:
config.write(configfile)
# Simple configuration with good options, without contacts field
account_key, domain_key, domain_csr, config = generate_config();
os.remove(domain_key)
config.remove_option("acmednstiny", "Contacts")
goodCNameWithoutContacts = NamedTemporaryFile(delete=False)
with open(goodCNameWithoutContacts.name, 'w') as configfile:
config.write(configfile)
# Simple configuration without CSR in configuration (will be passed as argument)
account_key, domain_key, domain_csr, config = generate_config();
os.remove(domain_key)
......@@ -170,6 +180,7 @@ def generate_acme_dns_tiny_config():
return {
# configs
"goodCName": goodCName.name,
"goodCNameWithoutContacts": goodCNameWithoutContacts.name,
"goodCNameWithoutCSR": goodCNameWithoutCSR.name,
"wildCName": wildCName.name,
"dnsHostIP": dnsHostIP.name,
......
......@@ -71,6 +71,19 @@ class TestACMEDNSTiny(unittest.TestCase):
self.assertCertificateChain(certchain)
def test_success_cn_without_contacts(self):
""" Successfully issue a certificate via CN, but without Contacts field """
old_stdout = sys.stdout
sys.stdout = StringIO()
acme_dns_tiny.main([self.configs['goodCNameWithoutContacts'], "--verbose"])
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
......
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