Append unit test (#2342)

reject-browser-part-of-url
Christophe Maudoux 5 years ago
parent b2306cc8ad
commit 41889e5ee2
  1. 1
      lemonldap-ng-portal/MANIFEST
  2. 2
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm
  3. 30
      lemonldap-ng-portal/t/01-Unauth-Logout.t

@ -476,6 +476,7 @@ t/01-AuthDemo.t
t/01-CSP-and-CORS-headers.t
t/01-Handler-redirection-and-URL-check-by-portal.t
t/01-pdata.t
t/01-Unauth-Logout.t
t/02-Password-Demo-Local-noPpolicy.t
t/02-Password-Demo-Local-Ppolicy.t
t/02-Password-Demo.t

@ -182,6 +182,8 @@ sub checkLogout {
sub checkUnauthLogout {
my ( $self, $req ) = @_;
if ( defined $req->param('logout') ) {
$self->logger->debug('Cleaning pdata');
$self->logger->debug("Removing $self->{conf}->{cookieName} cookie");
$req->pdata({});
$req->addCookie(
$self->cookie(

@ -0,0 +1,30 @@
use Test::More;
use strict;
require 't/test-lib.pm';
my $res;
my $client = LLNG::Manager::Test->new(
{ ini => { logLevel => 'debug', useSafeJail => 1 } } );
# Test normal first access
ok(
$res = $client->_get(
'/',
query => 'logout',
accept => 'text/html'
),
'Get logout page'
);
ok( $res->[2]->[0] =~ m%<span id="languages"></span>%, ' Language icons found' )
or print STDERR Dumper( $res->[2]->[0] );
ok( $res->[2]->[0] =~ m%<div class="message message-positive alert"><span trmsg="47">%, ' PE_LOGOUT_OK' )
or print STDERR Dumper( $res->[2]->[0] );
expectCookie($res);
count(3);
#print STDERR Dumper($res);
clean_sessions();
done_testing( count() );
Loading…
Cancel
Save