First running test (#595)
This commit is contained in:
parent
13051ce0af
commit
1a16c2dbc8
|
@ -36,7 +36,7 @@ our $_v = { session => {}, datas => {} };
|
|||
BEGIN {
|
||||
# Thread shared accessors
|
||||
foreach (
|
||||
qw(tsv cfgNum lastCheck checkTime confAcc localConfig logLevel _logLevel logLevels)
|
||||
qw(tsv cfgNum lastCheck checkTime confAcc localConfig logLevel _logLevel logLevels lmConf)
|
||||
)
|
||||
{
|
||||
eval " sub $_ {
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env perl -I pl/lib
|
||||
#
|
||||
# Test REST API with valid and invalid requests.
|
||||
# Check also metadatas request (root of a conf)
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ extends(
|
|||
'Lemonldap::NG::Handler::PSGI::Try',
|
||||
'Lemonldap::NG::Portal::Main::Init',
|
||||
'Lemonldap::NG::Portal::Main::Run',
|
||||
'Lemonldap::NG::Portal::Main::Process',
|
||||
);
|
||||
|
||||
1;
|
||||
|
|
|
@ -14,6 +14,8 @@ use Mouse;
|
|||
use Lemonldap::NG::Portal::Main::Constants;
|
||||
use Lemonldap::NG::Portal::Main::Request;
|
||||
|
||||
extends 'Lemonldap::NG::Portal::Main::Process';
|
||||
|
||||
our $VERSION = '2.0.0';
|
||||
|
||||
# List constants
|
||||
|
|
|
@ -14,7 +14,7 @@ sub changeUrldc {
|
|||
my $urldc = $req->datas->{urldc};
|
||||
if ( $req->id
|
||||
and $urldc !~ m#^https?://[^/]*$self->{conf}->{domain}(:\d+)?/#oi
|
||||
and $self->isTrustedUrl($urldc) )
|
||||
and $self->p->isTrustedUrl($urldc) )
|
||||
{
|
||||
my $ssl = $urldc =~ /^https/;
|
||||
$self->lmLog( 'CDA request', 'debug' );
|
||||
|
|
8
lemonldap-ng-portal/t/01-AuthDemo.t
Normal file
8
lemonldap-ng-portal/t/01-AuthDemo.t
Normal file
|
@ -0,0 +1,8 @@
|
|||
use Test::More;
|
||||
use strict;
|
||||
|
||||
require 't/test-lib.pm';
|
||||
|
||||
print STDERR Dumper(&client);
|
||||
|
||||
done_testing( count() );
|
58
lemonldap-ng-portal/t/lmConf-1.js
Normal file
58
lemonldap-ng-portal/t/lmConf-1.js
Normal file
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"authentication": "Demo",
|
||||
"cfgAuthor": "The LemonLDAP::NG team",
|
||||
"cfgAuthorIP": "127.0.0.1",
|
||||
"cfgDate": 1428138808,
|
||||
"cfgLog": "Handler test conf",
|
||||
"cfgNum": "1",
|
||||
"cookieName": "lemonldap",
|
||||
"demoExportedVars": {
|
||||
"cn": "cn",
|
||||
"mail": "mail",
|
||||
"uid": "uid"
|
||||
},
|
||||
"domain": "example.com",
|
||||
"exportedHeaders": {
|
||||
"test1.example.com": {
|
||||
"Auth-User": "$uid"
|
||||
},
|
||||
"test2.example.com": {
|
||||
"Auth-User": "$uid"
|
||||
}
|
||||
},
|
||||
"exportedVars": {
|
||||
"UA": "HTTP_USER_AGENT"
|
||||
},
|
||||
"globalStorage": "Apache::Session::File",
|
||||
"globalStorageOptions": {
|
||||
"Directory": "t/sessions",
|
||||
"LockDirectory": "t/sessions/lock",
|
||||
"generateModule": "Lemonldap::NG::Common::Apache::Session::Generate::SHA256"
|
||||
},
|
||||
"groups": {},
|
||||
"key": "qwertyui",
|
||||
"locationRules": {
|
||||
"manager.example.com": {
|
||||
"(?#Configuration)^/(manager\\.html|conf/)": "$uid eq \"dwho\"",
|
||||
"(?#Notifications)^/notifications": "$uid eq \"dwho\" or $uid eq \"rtyler\"",
|
||||
"(?#Sessions)^/sessions": "$uid eq \"dwho\" or $uid eq \"rtyler\"",
|
||||
"default": "$uid eq \"dwho\""
|
||||
},
|
||||
"test1.example.com": {
|
||||
"^/logout": "logout_sso",
|
||||
"^/deny": "deny",
|
||||
"default": "accept"
|
||||
},
|
||||
"test2.example.com": {
|
||||
"^/logout": "logout_sso",
|
||||
"default": "accept"
|
||||
}
|
||||
},
|
||||
"macros": {
|
||||
"_whatToTrace": "$_auth eq 'SAML' ? \"$_user\\@$_idpConfKey\" : \"$_user\""
|
||||
},
|
||||
"portal": "http://auth.example.com/",
|
||||
"reloadUrls": {},
|
||||
"userDB": "Demo",
|
||||
"whatToTrace": "_whatToTrace"
|
||||
}
|
46
lemonldap-ng-portal/t/test-lib.pm
Normal file
46
lemonldap-ng-portal/t/test-lib.pm
Normal file
|
@ -0,0 +1,46 @@
|
|||
# Base library for portal tests
|
||||
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
use 5.10.0;
|
||||
use_ok('Lemonldap::NG::Common::PSGI::Cli::Lib');
|
||||
use_ok('Lemonldap::NG::Portal::Main');
|
||||
|
||||
our $client;
|
||||
our $count = 3;
|
||||
$Data::Dumper::Deparse = 1;
|
||||
|
||||
ok(
|
||||
$client = Lemonldap::NG::Common::PSGI::Cli::Lib->new(
|
||||
{
|
||||
app => Lemonldap::NG::Portal::Main->run(
|
||||
{
|
||||
configStorage => { type => 'File', dirName => 't' },
|
||||
logLevel => 'warn',
|
||||
cookieName => 'lemonldap',
|
||||
securedCookie => 0,
|
||||
https => 0,
|
||||
}
|
||||
),
|
||||
}
|
||||
),
|
||||
'Portal app'
|
||||
);
|
||||
|
||||
sub client {
|
||||
return $client;
|
||||
}
|
||||
|
||||
sub count {
|
||||
my $c = shift;
|
||||
$count += $c if ($c);
|
||||
return $count;
|
||||
}
|
||||
|
||||
sub explain {
|
||||
my ( $get, $ref ) = @_;
|
||||
$get = Dumper($get) if ( ref $get );
|
||||
print STDERR "Expect $ref, get $get\n";
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue
Block a user