Skip to content
Snippets Groups Projects
Commit 5d704542 authored by gregor herrmann's avatar gregor herrmann
Browse files

Add patch for CGI.pm >= 4.66 compatibility.

Taken from upstream Git commit.

Thanks: Chris Peterson for the bug report.
Closes: #1074399
LP: #2071369
parent 15e519fc
No related branches found
No related tags found
No related merge requests found
From 474ac92df5b9b4cae6542892af7faad4ce5ef432 Mon Sep 17 00:00:00 2001
From: Wes Malone <wes@mitsi.com>
Date: Fri, 28 Jun 2024 14:35:00 -0500
Subject: [PATCH] Fix test failures due to URI differences CGI >= 4.66
Those regression tests with full html are brittle. I don't want to force
a CGI dep upgrade just to keep a test matching so here we mutate the
expected result based on the behavior of the underlying CGI.
Co-authored-by: Chris Peterson <chris.peterson@canonical.com>
Bug: https://github.com/MicroTechnology-Services/cgi-application-plugin-authentication/pull/2
Bug-Debian: https://bugs.debian.org/1074399
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libcgi-application-plugin-authentication-perl/+bug/2071369
---
Changes | 1 +
t/03_login_box_basic.t | 8 +++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/t/03_login_box_basic.t b/t/03_login_box_basic.t
index b0eff2f..4c14578 100644
--- a/t/03_login_box_basic.t
+++ b/t/03_login_box_basic.t
@@ -74,7 +74,13 @@ subtest 'empty' => sub {
isa_ok($display, 'CGI::Application::Plugin::Authentication::Display');
isa_ok($display, 'CGI::Application::Plugin::Authentication::Display::Basic');
is($display->login_title, 'Sign In', 'title');
- ok_regression(sub {return $display->login_box}, 't/out/basic_login_box', 'login box');
+ my $login_box_output = $display->login_box;
+ my $selfurl = $cgiapp->authen->_detaint_selfurl;
+ # shim to support CGIs >= 4.66 that return urls with trailing slashes
+ if ($selfurl eq 'http://localhost/') {
+ $login_box_output =~ s|value="$selfurl"|value="http://localhost"|;
+ }
+ ok_regression(sub { $login_box_output }, 't/out/basic_login_box', 'login box');
is($display->logout_form, '', 'logout_form');
is($display->is_authenticated, 0, 'is_authenticated');
is($display->username, undef, 'username');
Fix_test_failures_due_to_URI_differences_CGI_>=_4.66.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment