Commit bc954b24 authored by Adrien Dorsaz's avatar Adrien Dorsaz

test: add a test to check an error is raised if configuration is not complete

parent 835bb9b7
......@@ -87,13 +87,19 @@ def gen_configs():
config["acmednstiny"]["CSRFile"] = account_csr.name
with open(accountAsDomain.name, 'w') as configfile:
config.write(configfile)
missingDNS = NamedTemporaryFile()
config["DNS"] = {}
with open(missingDNS.name, 'w') as configfile:
config.write(configfile)
return {
"goodCName": goodCName,
"dnsHostIP": dnsHostIP,
"goodSAN": goodSAN,
"weakKey": weakKey,
"accountAsDomain": accountAsDomain,
"missingDNS": missingDNS,
"key": {"accountkey": account_key,
"weakkey": weak_key,
"domainkey": domain_key},
......
......@@ -83,6 +83,14 @@ class TestModule(unittest.TestCase):
self.assertIsInstance(result, ValueError)
self.assertIn("Certificate public key must be different than account key", result.args[0])
def test_failure_notcompleted_configuration(self):
""" Configuration file have to be completed """
try:
result = acme_dns_tiny.main([CONFIGS['missingDNS'].name])
except Exception as e:
result = e
self.assertIsInstance(result, ValueError)
self.assertIn("Some required settings are missing.", result.args[0])
if __name__ == "__main__":
unittest.main()
......
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