Commit e41a13cf authored by Adrien Dorsaz's avatar Adrien Dorsaz

test: add invalid TSIG test to confirm a failure is raised if key name isn't the good one

parent bc954b24
......@@ -88,6 +88,11 @@ def gen_configs():
with open(accountAsDomain.name, 'w') as configfile:
config.write(configfile)
invalidTSIGName = NamedTemporaryFile()
config["TSIGKeyring"]["KeyName"] = "{0}.invalid".format(TSIGKEYNAME)
with open(invalidTSIGName.name, 'w') as configfile:
config.write(configfile)
missingDNS = NamedTemporaryFile()
config["DNS"] = {}
with open(missingDNS.name, 'w') as configfile:
......@@ -99,6 +104,7 @@ def gen_configs():
"goodSAN": goodSAN,
"weakKey": weakKey,
"accountAsDomain": accountAsDomain,
"invalidTSIGName": invalidTSIGName,
"missingDNS": missingDNS,
"key": {"accountkey": account_key,
"weakkey": weak_key,
......
......@@ -83,6 +83,15 @@ 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_dns_update_tsigkeyname(self):
""" Fail to update DNS records by invalid TSIG Key name """
try:
result = acme_dns_tiny.main([CONFIGS['invalidTSIGName'].name])
except Exception as e:
result = e
self.assertIsInstance(result, ValueError)
self.assertIn("Error updating DNS", result.args[0])
def test_failure_notcompleted_configuration(self):
""" Configuration file have to be completed """
try:
......
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