Commit 558acd1d authored by Adrien Dorsaz's avatar Adrien Dorsaz

tests: adjust temp file deletion and config keys

parent 01eb11c6
...@@ -25,6 +25,7 @@ class TestACMEAccountDeactivate(unittest.TestCase): ...@@ -25,6 +25,7 @@ class TestACMEAccountDeactivate(unittest.TestCase):
super(TestACMEAccountDeactivate, cls).setUpClass() super(TestACMEAccountDeactivate, cls).setUpClass()
# To clean ACME staging server and close correctly temporary files # To clean ACME staging server and close correctly temporary files
#pylint: disable=bare-except
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
# Remove temporary files # Remove temporary files
...@@ -32,9 +33,15 @@ class TestACMEAccountDeactivate(unittest.TestCase): ...@@ -32,9 +33,15 @@ class TestACMEAccountDeactivate(unittest.TestCase):
parser.read(cls.configs['config']) parser.read(cls.configs['config'])
try: try:
os.remove(parser["acmednstiny"]["AccountKeyFile"]) os.remove(parser["acmednstiny"]["AccountKeyFile"])
except:
pass
try:
os.remove(parser["acmednstiny"]["CSRFile"]) os.remove(parser["acmednstiny"]["CSRFile"])
except:
pass
try:
os.remove(cls.configs['config']) os.remove(cls.configs['config'])
except: #pylint: disable=bare-except except:
pass pass
super(TestACMEAccountDeactivate, cls).tearDownClass() super(TestACMEAccountDeactivate, cls).tearDownClass()
......
...@@ -20,6 +20,7 @@ class TestACMEAccountRollover(unittest.TestCase): ...@@ -20,6 +20,7 @@ class TestACMEAccountRollover(unittest.TestCase):
super(TestACMEAccountRollover, cls).setUpClass() super(TestACMEAccountRollover, cls).setUpClass()
# To clean ACME staging server and close correctly temporary files # To clean ACME staging server and close correctly temporary files
#pylint: disable=bare-except
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
# deactivate account key registration at end of tests # deactivate account key registration at end of tests
...@@ -30,18 +31,27 @@ class TestACMEAccountRollover(unittest.TestCase): ...@@ -30,18 +31,27 @@ class TestACMEAccountRollover(unittest.TestCase):
parser.read(cls.configs['config']) parser.read(cls.configs['config'])
try: try:
os.remove(parser["acmednstiny"]["AccountKeyFile"]) os.remove(parser["acmednstiny"]["AccountKeyFile"])
except:
pass
try:
os.remove(parser["acmednstiny"]["CSRFile"]) os.remove(parser["acmednstiny"]["CSRFile"])
os.remove(cls.configs["newaccountkey"]) except:
pass
try:
os.remove(cls.configs["new_account_key"])
except:
pass
try:
os.remove(cls.configs['config']) os.remove(cls.configs['config'])
except: #pylint: disable=bare-except except:
pass pass
super(TestACMEAccountRollover, cls).tearDownClass() super(TestACMEAccountRollover, cls).tearDownClass()
def test_success_account_rollover(self): def test_success_account_rollover(self):
""" Test success account key rollover """ """ Test success account key rollover """
with self.assertLogs(level='INFO') as accountrolloverlog: with self.assertLogs(level='INFO') as accountrolloverlog:
tools.acme_account_rollover.main(["--current", self.configs['oldaccountkey'], tools.acme_account_rollover.main(["--current", self.configs['old_account_key'],
"--new", self.configs['newaccountkey'], "--new", self.configs['new_account_key'],
"--acme-directory", ACME_DIRECTORY]) "--acme-directory", ACME_DIRECTORY])
self.assertIn("INFO:acme_account_rollover:Account keys rolled over !", self.assertIn("INFO:acme_account_rollover:Account keys rolled over !",
accountrolloverlog.output) accountrolloverlog.output)
......
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