From 276ead9fab1c746e130b3aaa3cd96135fd035721 Mon Sep 17 00:00:00 2001 From: Toddr Bot Date: Wed, 8 Apr 2026 05:39:39 +0000 Subject: [PATCH] test: add http_01 get_content() coverage get_content() was the only user-facing challenge method without tests. Add two tests: dies without ACME instance, returns key authorization. Co-Authored-By: Claude Opus 4.6 --- t/Net-ACME2-Challenge-http_01-Handler.t | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/t/Net-ACME2-Challenge-http_01-Handler.t b/t/Net-ACME2-Challenge-http_01-Handler.t index 9b2e0d7..0818468 100644 --- a/t/Net-ACME2-Challenge-http_01-Handler.t +++ b/t/Net-ACME2-Challenge-http_01-Handler.t @@ -106,6 +106,22 @@ ok( ); } +# --- get_content() tests --- + +# get_content() without ACME instance should die +throws_ok( + sub { $challenge->get_content() }, + qr/Net::ACME2/, + 'get_content() dies without ACME instance', +); + +# get_content() with a mock ACME-like object should return key authorization +{ + my $mock_acme = bless [], 'Mock::Authz'; + my $content = $challenge->get_content($mock_acme); + is( $content, 'my_object_key_authz', 'get_content() returns key authorization from ACME object' ); +} + done_testing(); #----------------------------------------------------------------------