Fix ContextSwitching redirect & update unit tests (#2273)

This commit is contained in:
Christophe Maudoux 2020-08-08 20:00:41 +02:00
parent f4ec555ca0
commit a1ebb0ee02
5 changed files with 14 additions and 24 deletions

View File

@ -193,7 +193,8 @@ sub run {
$self->userLogger->notice(
"ContextSwitching: Update \"$realId\" session with \"$spoofId\" session data"
);
$req->mustRedirect(1);
return $self->p->do( $req, [ sub { $statut } ] );
}

View File

@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
/*
LemonLDAP::NG TOTP registration script

View File

@ -145,11 +145,8 @@ ok(
),
'POST switchcontext'
);
ok( $res->[2]->[0] =~ m%<span trspan="contextSwitching_OFF">%,
'Found trspan="contextSwitching_OFF"' )
or explain( $res->[2]->[0], 'trspan="contextSwitching_OFF"' );
expectRedirection( $res, 'http://auth.example.com/' );
my $id2 = expectCookie($res);
ok(
$res = $client->_get(
'/',
@ -158,7 +155,8 @@ ok(
),
'Get Menu',
);
count(4);
count(3);
expectAuthenticatedAs( $res, 'dwho' );
ok( $res->[2]->[0] =~ m%<span trspan="contextSwitching_OFF">%,
'Found trspan="contextSwitching_OFF"' )

View File

@ -204,9 +204,7 @@ ok(
),
'POST switchcontext'
);
ok( $res->[2]->[0] =~ m%<span trspan="contextSwitching_OFF">%,
'Found trspan="contextSwitching_OFF"' )
or explain( $res->[2]->[0], 'trspan="contextSwitching_OFF"' );
expectRedirection( $res, 'http://auth.example.com/' );
$id = expectCookie($res);
ok(
$res = $client->_get(
@ -220,7 +218,7 @@ expectAuthenticatedAs( $res, 'dwho' );
ok( $res->[2]->[0] =~ m%<span trspan="contextSwitching_OFF">%,
'Found trspan="contextSwitching_OFF"' )
or explain( $res->[2]->[0], 'trspan="contextSwitching_OFF"' );
count(6);
count(5);
# CheckUser form
ok(
@ -292,9 +290,7 @@ ok(
),
'POST switchcontext'
);
ok( $res->[2]->[0] =~ m%<span trspan="contextSwitching_OFF">%,
'Found trspan="contextSwitching_OFF"' )
or explain( $res->[2]->[0], 'trspan="contextSwitching_OFF"' );
expectRedirection( $res, 'http://auth.example.com/' );
$id = expectCookie($res);
ok(
$res = $client->_get(
@ -308,7 +304,7 @@ expectAuthenticatedAs( $res, 'msmith' );
ok( $res->[2]->[0] =~ m%<span trspan="contextSwitching_OFF">%,
'Found trspan="contextSwitching_OFF"' )
or explain( $res->[2]->[0], 'trspan="contextSwitching_OFF"' );
count(6);
count(5);
# Stop ContextSwitching
# ------------------------

View File

@ -105,11 +105,8 @@ ok(
),
'POST switchcontext'
);
ok( $res->[2]->[0] =~ m%<span trspan="contextSwitching_OFF">%,
'Found trspan="contextSwitching_OFF"' )
or explain( $res->[2]->[0], 'trspan="contextSwitching_OFF"' );
expectRedirection( $res, 'http://auth.example.com/' );
my $id2 = expectCookie($res);
ok(
$res = $client->_get(
'/',
@ -122,7 +119,7 @@ expectAuthenticatedAs( $res, 'dwho' );
ok( $res->[2]->[0] =~ m%<span trspan="contextSwitching_OFF">%,
'Found trspan="contextSwitching_OFF"' )
or explain( $res->[2]->[0], 'trspan="contextSwitching_OFF"' );
count(4);
count(3);
# Stop ContextSwitching
# ------------------------
@ -238,9 +235,7 @@ ok(
),
'POST switchcontext'
);
ok( $res->[2]->[0] =~ m%<span trspan="contextSwitching_OFF">%,
'Found trspan="contextSwitching_OFF"' )
or explain( $res->[2]->[0], 'trspan="contextSwitching_OFF"' );
expectRedirection( $res, 'http://auth.example.com/' );
$id2 = expectCookie($res);
ok(
$res = $client->_get(
@ -254,7 +249,7 @@ expectAuthenticatedAs( $res, 'msmith' );
ok( $res->[2]->[0] =~ m%<span trspan="contextSwitching_OFF">%,
'Found trspan="contextSwitching_OFF"' )
or explain( $res->[2]->[0], 'trspan="contextSwitching_OFF"' );
count(4);
count(3);
$client->logout($id);
$client->logout($id2);