From 2a8066b54bf0af166419440ce7a67b57d361a9dd Mon Sep 17 00:00:00 2001 From: Roland Bracewell Shoemaker Date: Wed, 31 Jan 2018 17:22:07 -0800 Subject: [PATCH] Refactor revocation integration tests (#3415) Fixes #3330. --- test/chisel2.py | 2 ++ test/integration-test-v2.py | 26 +++----------------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/test/chisel2.py b/test/chisel2.py index c096adfd1..840545945 100644 --- a/test/chisel2.py +++ b/test/chisel2.py @@ -142,6 +142,8 @@ def auth_and_issue(domains, chall_type="http-01", email=None, cert_output=None, finally: cleanup() + return order + def do_dns_challenges(client, authzs): cleanup_hosts = [] for a in authzs: diff --git a/test/integration-test-v2.py b/test/integration-test-v2.py index 8ffd4aaae..6af06fbaf 100644 --- a/test/integration-test-v2.py +++ b/test/integration-test-v2.py @@ -130,38 +130,18 @@ def test_wildcard_authz_reuse(): def test_revoke_by_issuer(): client = make_client(None) - domains = [random_domain()] - csr_pem = make_csr(domains) - order = client.new_order(csr_pem) - cleanup = do_http_challenges(client, order.authorizations) - try: - order = client.poll_order_and_request_issuance(order) - finally: - cleanup() + order = auth_and_issue([random_domain()], client=client) cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, order.fullchain_pem) client.revoke(jose.ComparableX509(cert), 0) def test_revoke_by_authz(): - client = make_client(None) domains = [random_domain()] - csr_pem = make_csr(domains) - order = client.new_order(csr_pem) - cleanup = do_http_challenges(client, order.authorizations) - try: - order = client.poll_order_and_request_issuance(order) - finally: - cleanup() + order = auth_and_issue(domains) # create a new client and re-authz client = make_client(None) - csr_pem = make_csr(domains) - second_order = client.new_order(csr_pem) - cleanup = do_http_challenges(client, second_order.authorizations) - try: - second_order = client.poll_order_and_request_issuance(second_order) - finally: - cleanup() + auth_and_issue(domains, client=client) cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, order.fullchain_pem) client.revoke(jose.ComparableX509(cert), 0)