Commit 22704130 authored by Xavier Guimard's avatar Xavier Guimard

Start token test (#1140)

parent dab5921d
......@@ -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
......
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) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment