Lines 22-27
use Module::Load::Conditional qw/check_install/;
Link Here
|
22 |
use Test::More; |
22 |
use Test::More; |
23 |
use Test::MockModule; |
23 |
use Test::MockModule; |
24 |
use Test::Warn; |
24 |
use Test::Warn; |
|
|
25 |
use File::Temp qw(tempdir); |
25 |
|
26 |
|
26 |
use CGI; |
27 |
use CGI; |
27 |
use C4::Context; |
28 |
use C4::Context; |
Lines 124-141
subtest "shib_ok tests" => sub {
Link Here
|
124 |
#is(logout_shib($query),"https://".$opac."/Shibboleth.sso/Logout?return="."https://".$opac,"logout_shib"); |
125 |
#is(logout_shib($query),"https://".$opac."/Shibboleth.sso/Logout?return="."https://".$opac,"logout_shib"); |
125 |
|
126 |
|
126 |
## login_shib_url |
127 |
## login_shib_url |
127 |
my $query_string = 'language=en-GB'; |
128 |
subtest "login_shib_url tests" => sub { |
128 |
$ENV{QUERY_STRING} = $query_string; |
129 |
plan tests => 2; |
129 |
$ENV{SCRIPT_NAME} = '/cgi-bin/koha/opac-user.pl'; |
130 |
|
130 |
my $query = CGI->new($query_string); |
131 |
my $query_string = 'language=en-GB'; |
131 |
is( |
132 |
|
132 |
login_shib_url($query), |
133 |
local $ENV{REQUEST_METHOD} = 'GET'; |
133 |
'https://testopac.com' |
134 |
local $ENV{QUERY_STRING} = $query_string; |
134 |
. '/Shibboleth.sso/Login?target=' |
135 |
local $ENV{SCRIPT_NAME} = '/cgi-bin/koha/opac-user.pl'; |
135 |
. 'https://testopac.com/cgi-bin/koha/opac-user.pl' . '%3F' |
136 |
my $query = CGI->new($query_string); |
136 |
. $query_string, |
137 |
is( |
137 |
"login shib url" |
138 |
login_shib_url($query), |
138 |
); |
139 |
'https://testopac.com' |
|
|
140 |
. '/Shibboleth.sso/Login?target=' |
141 |
. 'https://testopac.com/cgi-bin/koha/opac-user.pl' . '%3F' |
142 |
. $query_string, |
143 |
"login shib url" |
144 |
); |
145 |
|
146 |
my $post_params = 'user=bob&password=wideopen'; |
147 |
local $ENV{REQUEST_METHOD} = 'POST'; |
148 |
local $ENV{CONTENT_LENGTH} = length($post_params); |
149 |
|
150 |
my $dir = tempdir( CLEANUP => 1 ); |
151 |
my $infile = "$dir/in.txt"; |
152 |
open my $fh_write, '>', $infile or die "Could not open '$infile' $!"; |
153 |
print $fh_write $post_params; |
154 |
close $fh_write; |
155 |
|
156 |
open my $fh_read, '<', $infile or die "Could not open '$infile' $!"; |
157 |
|
158 |
$query = CGI->new($fh_read); |
159 |
is( |
160 |
login_shib_url($query), |
161 |
'https://testopac.com' |
162 |
. '/Shibboleth.sso/Login?target=' |
163 |
. 'https://testopac.com/cgi-bin/koha/opac-user.pl', |
164 |
"login shib url" |
165 |
); |
166 |
|
167 |
close $fh_read; |
168 |
}; |
139 |
|
169 |
|
140 |
## get_login_shib |
170 |
## get_login_shib |
141 |
subtest "get_login_shib tests" => sub { |
171 |
subtest "get_login_shib tests" => sub { |
142 |
- |
|
|