From 34df64db523684b66cc3814a384f67e5e398ed67 Mon Sep 17 00:00:00 2001 From: Shiloh Heurich Date: Thu, 8 Feb 2024 17:33:24 -0500 Subject: [PATCH] feat: add dns-account-01 integration test in chisel --- test/chisel2.py | 16 ++++++++++++++++ test/v2_integration.py | 3 +++ 2 files changed, 19 insertions(+) diff --git a/test/chisel2.py b/test/chisel2.py index 760ffc1baa8..ca8012f3fe9 100644 --- a/test/chisel2.py +++ b/test/chisel2.py @@ -124,6 +124,8 @@ def auth_and_issue(domains, chall_type="dns-01", email=None, cert_output=None, c cleanup = do_http_challenges(client, authzs) elif chall_type == "dns-01": cleanup = do_dns_challenges(client, authzs) + elif chall_type == "dns-account-01": + cleanup = do_dns_account_challenges(client, authzs) elif chall_type == "tls-alpn-01": cleanup = do_tlsalpn_challenges(client, authzs) else: @@ -153,6 +155,20 @@ def cleanup(): challSrv.remove_dns01_response(host) return cleanup +def do_dns_account_challenges(client, authzs): + cleanup_hosts = [] + for a in authzs: + c = get_chall(a, challenges.DNSACCOUNT01) + name, value = (c.validation_domain_name(client.net.account.uri, a.body.identifier.value), + c.validation(client.net.key)) + cleanup_hosts.append(name) + challSrv.add_dns01_response(name, value) + client.answer_challenge(c, c.response(client.net.key)) + def cleanup(): + for host in cleanup_hosts: + challSrv.remove_dns01_response(host) + return cleanup + def do_http_challenges(client, authzs): cleanup_tokens = [] challs = [get_chall(a, challenges.HTTP01) for a in authzs] diff --git a/test/v2_integration.py b/test/v2_integration.py index 184a422cc90..582b56afac0 100644 --- a/test/v2_integration.py +++ b/test/v2_integration.py @@ -45,6 +45,9 @@ import challtestsrv challSrv = challtestsrv.ChallTestServer() +def test_dns_account_challenge(): + chisel2.auth_and_issue([random_domain(), random_domain()], chall_type="dns-account-01") + def test_multidomain(): chisel2.auth_and_issue([random_domain(), random_domain()])