Commit b4333aa8 authored by Adrien Dorsaz's avatar Adrien Dorsaz

v2: update tests key rollover

parent 667eb0b7
......@@ -122,11 +122,32 @@ def generate_acme_account_rollover_config():
# Old account key
old_account_key = NamedTemporaryFile()
Popen(["openssl", "genrsa", "-out", old_account_key.name, "2048"]).wait()
# New account key
new_account_key = NamedTemporaryFile()
Popen(["openssl", "genrsa", "-out", new_account_key.name, "2048"]).wait()
# default test configuration
config = configparser.ConfigParser()
config.read("./example.ini".format(DOMAIN))
config["acmednstiny"]["AccountKeyFile"] = account_key.name
config["acmednstiny"]["CSRFile"] = account_key.name
config["acmednstiny"]["ACMEDirectory"] = ACMEDIRECTORY
config["acmednstiny"]["CheckChallengeDelay"] = CHALLENGEDELAY
config["TSIGKeyring"]["KeyName"] = TSIGKEYNAME
config["TSIGKeyring"]["KeyValue"] = TSIGKEYVALUE
config["TSIGKeyring"]["Algorithm"] = TSIGALGORITHM
config["DNS"]["Host"] = DNSHOST
config["DNS"]["Port"] = DNSPORT
config["DNS"]["Zone"] = DNSZONE
deactivateConfig = NamedTemporaryFile()
with open(deactivateConfig.name, 'w') as configfile:
config.write(configfile)
return {
# keys (returned to keep files on system)
# config and keys (returned to keep files on system)
"config": config,
"oldaccountkey": old_account_key,
"newaccountkey": new_account_key
}
......
......@@ -4,7 +4,7 @@ from tests.config_factory import generate_acme_account_rollover_config
from tools.acme_account_deactivate import account_deactivate
import tools.acme_account_rollover
ACMEDirectory = os.getenv("GITLABCI_ACMEDIRECTORY", "https://acme-staging.api.letsencrypt.org/directory")
ACMEDirectory = os.getenv("GITLABCI_ACMEDIRECTORY_V2", "https://acme-staging-v02.api.letsencrypt.org/directory")
class TestACMEAccountRollover(unittest.TestCase):
"Tests for acme_account_rollover"
......@@ -12,6 +12,7 @@ class TestACMEAccountRollover(unittest.TestCase):
@classmethod
def setUpClass(self):
self.configs = generate_acme_account_rollover_config()
acme_dns_tiny.main([self.configs['config'].name])
super(TestACMEAccountRollover, self).setUpClass()
# To clean ACME staging server and close correctly temporary files
......
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