Start token test (#1140)
This commit is contained in:
parent
dab5921d64
commit
22704130b2
|
@ -41,6 +41,7 @@ lib/Lemonldap/NG/Portal/Issuer/Get.pm
|
|||
lib/Lemonldap/NG/Portal/Issuer/OpenID.pm
|
||||
lib/Lemonldap/NG/Portal/Issuer/OpenIDConnect.pm
|
||||
lib/Lemonldap/NG/Portal/Issuer/SAML.pm
|
||||
lib/Lemonldap/NG/Portal/Lib/Captcha.pm
|
||||
lib/Lemonldap/NG/Portal/Lib/CAS.pm
|
||||
lib/Lemonldap/NG/Portal/Lib/Choice.pm
|
||||
lib/Lemonldap/NG/Portal/Lib/DBI.pm
|
||||
|
@ -362,6 +363,7 @@ t/35-REST-sessions-with-REST-server.t
|
|||
t/35-SOAP-sessions-with-SOAP-server.t
|
||||
t/40-Notifications-DBI.t
|
||||
t/41-Register-Demo.t
|
||||
t/42-Token.t
|
||||
t/50-IssuerGet.t
|
||||
t/60-status.t
|
||||
t/90-translations.t
|
||||
|
|
25
lemonldap-ng-portal/t/42-Token.t
Normal file
25
lemonldap-ng-portal/t/42-Token.t
Normal file
|
@ -0,0 +1,25 @@
|
|||
use Test::More;
|
||||
use strict;
|
||||
use IO::String;
|
||||
|
||||
require 't/test-lib.pm';
|
||||
|
||||
my $res;
|
||||
|
||||
my $client = LLNG::Manager::Test->new(
|
||||
{ ini => { logLevel => 'debug', useSafeJail => 1, requireToken => 1, } } );
|
||||
|
||||
# Test normal first access
|
||||
# ------------------------
|
||||
ok( $res = $client->_get('/'), 'Unauth JSON request' );
|
||||
count(1);
|
||||
expectReject($res);
|
||||
|
||||
ok( $res = $client->_get( '/', accept => 'text/html' ), 'Unauth request' );
|
||||
count(1);
|
||||
|
||||
my ( $host, $url, $query ) = expectForm( $res, '#', undef, 'token' );
|
||||
|
||||
clean_sessions();
|
||||
|
||||
done_testing( count() );
|
|
@ -110,7 +110,8 @@ m@<form.+?action="(?:http://([^/]+)(/.*?)?|(#))".+method="(post|get)"@is,
|
|||
count(1);
|
||||
}
|
||||
my %fields =
|
||||
( $res->[2]->[0] =~ m#<input.+?name="(.+?)".+?value="(.*?)"#gs );
|
||||
( $res->[2]->[0] =~
|
||||
m#<input.+?name="([^"]+)"[^>]+?value="([^"]*?)"#gs );
|
||||
my $query = join( '&',
|
||||
map { "$_=" . uri_escape( uri_unescape( $fields{$_} ) ) }
|
||||
keys(%fields) );
|
||||
|
|
Loading…
Reference in New Issue
Block a user