Update tests

This commit is contained in:
Xavier Guimard 2015-05-14 06:45:03 +00:00
parent d220b90198
commit ce77b54114
21 changed files with 123 additions and 141 deletions

View File

@ -34,10 +34,8 @@ PORTALSKINSDIR=$(PORTALDIR)/skins
RPORTALSKINSDIR=$(DESTDIR)/$(PORTALSKINSDIR)
MANAGERDIR=$(DOCUMENTROOT)/manager
RMANAGERDIR=$(DESTDIR)/$(MANAGERDIR)
MANAGERSKINSDIR=$(MANAGERDIR)/skins
RMANAGERSKINSDIR=$(DESTDIR)/$(MANAGERSKINSDIR)
SESSIONSEXPLORERDIR=$(MANAGERDIR)
RSESSIONSEXPLORERDIR=$(DESTDIR)/$(SESSIONSEXPLORERDIR)
MANAGERSITEDIR=$(MANAGERDIR)/site
RMANAGERSITEDIR=$(DESTDIR)/$(MANAGERSITEDIR)
DOCDIR=$(DOCUMENTROOT)
RDOCDIR=$(DESTDIR)/$(DOCDIR)
DEFDOCDIR=$(DOCUMENTROOT)/doc
@ -102,7 +100,6 @@ VHOSTLISTEN=*:80
# Other
VERSION=`head -n1 changelog |sed -e 's/lemonldap-ng (//' -e 's/).*$$//'`
PORTALSKINS=`ls lemonldap-ng-portal/example/skins/`
MANAGERSKINS=`ls lemonldap-ng-manager/example/skins/`
DIFF=diff -aurN -x '*.bak' -x .svn -x '*.swp' --ignore-matching-lines='.*jquery.*' --ignore-matching-lines='.*lemonldap-ng\.ini.*'
SRCCOMMONDIR=lemonldap-ng-common
@ -241,8 +238,8 @@ install_bin: install_conf_dir
${SRCPORTALDIR}/example/scripts/buildPortalWSDL \
${SRCCOMMONDIR}/scripts/convertConfig \
${SRCCOMMONDIR}/scripts/lmMigrateConfFiles2ini \
${SRCMANAGERDIR}/example/scripts/lmConfigEditor \
${SRCMANAGERDIR}/example/scripts/lemonldap-ng-cli \
${SRCMANAGERDIR}/scripts/lmConfigEditor \
${SRCMANAGERDIR}/scripts/lemonldap-ng-cli \
$(RBINDIR)
@if [ ! "$(APACHEUSER)" ]; then \
$(PERL) -i -pe 's#__APACHEUSER__#nobody#g;' $(RBINDIR)/lmConfigEditor; \
@ -283,7 +280,7 @@ install_site: install_manager_site install_portal_site install_handler_site inst
s#__FRDOCDIR__#$(FRDOCDIR)/#g;' $(RCONFDIR)/*apache*.conf
@$(PERL) -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $(RCONFDIR)/for_etc_hosts
# Fix a lost of rights on the main directory
@chmod 755 $(RBINDIR) $(RDOCUMENTROOT) $(REXAMPLESDIR) $(RHANDLERDIR) $(RPORTALSKINSDIR) $(RMANAGERSKINSDIR) $(RTOOLSDIR) $(RCONFDIR) $(RDATADIR)
@chmod 755 $(RBINDIR) $(RDOCUMENTROOT) $(REXAMPLESDIR) $(RHANDLERDIR) $(RPORTALSKINSDIR) $(RMANAGERSITEDIR) $(RTOOLSDIR) $(RCONFDIR) $(RDATADIR)
@echo
@echo "LemonLDAP::NG v${VERSION} is installed with these parameters:"
@echo " - System configuration: ${CONFDIR}"
@ -317,28 +314,11 @@ install_site: install_manager_site install_portal_site install_handler_site inst
install_manager_site: install_conf_dir
# Manager install
@install -v -d ${RMANAGERDIR} ${RMANAGERSKINSDIR} \
${RSESSIONSEXPLORERDIR} \
$(RCONFDIR) ${RMANAGERDIR}/skins/
@for skin in $$(ls lemonldap-ng-manager/example/skins/); do \
[ -h $(RMANAGERDIR)/skins/$$skin ] && rm -f $(RMANAGERDIR)/skins/$$skin; \
install -v -d $(RMANAGERSKINSDIR)/$$skin; \
done
@cp -pR -f ${SRCMANAGERDIR}/example/index.pl ${RMANAGERDIR}
@cp -pR -f ${SRCMANAGERDIR}/example/*.html ${RMANAGERDIR}
@cp -pR -f ${SRCMANAGERDIR}/example/skins/* $(RMANAGERSKINSDIR)
@if [ "$(MANAGERDIR)/skins/" != "$(MANAGERSKINSDIR)/" ]; then \
for skin in $$(ls lemonldap-ng-manager/example/skins/); do \
rm -rf $(RMANAGERDIR)/skins/$$skin/; \
ln -s $(MANAGERSKINSDIR)/$$skin $(RMANAGERDIR)/skins/$$skin; \
done; \
fi
@install -v -d ${RMANAGERDIR} ${RMANAGERSITEDIR} \
$(RCONFDIR) ${RMANAGERDIR}
@$(PERL) -i -pe 's/__DNSDOMAIN__/$(DNSDOMAIN)/g' $(RCONFDIR)/$(CONFFILENAME)
# Sessions explorer and notifications explorer install
@cp -pR -f ${SRCMANAGERDIR}/example/sessions.pl $(RSESSIONSEXPLORERDIR)
@cp -pR -f ${SRCMANAGERDIR}/example/notifications.pl $(RSESSIONSEXPLORERDIR)
@rm -rf $$(find ${RMANAGERDIR} ${RMANAGERSKINSDIR} \
${RSESSIONSEXPLORERDIR} \
@rm -rf $$(find ${RMANAGERDIR} ${RMANAGERSITEDIR} \
$(RCONFDIR) -type d -name .svn)
install_portal_site: install_conf_dir
@ -673,9 +653,6 @@ debian-diff:
@$(DIFF) lemonldap-ng-manager/example/notifications.pl $(DIFFPREFIX)/var/lib/lemonldap-ng/manager/notifications.pl ||true
@$(DIFF) --ignore-matching-lines='set.*get.*\[2\]' lemonldap-ng-manager/example/scripts/lmConfigEditor $(DIFFPREFIX)/usr/share/lemonldap-ng/bin/lmConfigEditor ||true
@$(DIFF) --ignore-matching-lines='giveUpPrivileges' lemonldap-ng-manager/example/scripts/lemonldap-ng-cli $(DIFFPREFIX)/usr/share/lemonldap-ng/bin/lemonldap-ng-cli ||true
@for i in $(MANAGERSKINS); do \
$(DIFF) -x 'jquery*' lemonldap-ng-manager/example/skins/$$i $(DIFFPREFIX)/usr/share/lemonldap-ng/manager-skins/$$i; \
done ||true
default-diff:
@# Portal

View File

@ -86,7 +86,7 @@ sub getAll {
date => $1,
uid => $2,
ref => decode_base64($3),
condition => decode_base64($4)
condition => decode_base64( $4 // '' )
}
)
: ()

View File

@ -77,7 +77,7 @@ sub genRoute {
}
}
sub abort {
sub routerAbort {
my ( $self, $path, $msg ) = splice @_;
delete $self->routes->{$path};
$self->addRoute(

View File

@ -32,11 +32,6 @@ site-test/e2e/99-logout.js
site-test/e2e/README.md
site-test/protractor-conf.js
site/psgi/manager-server.psgi
site/static/authParams.html
site/static/blackWhiteList.html
site/static/bool.html
site/static/boolOrExpr.html
site/static/bootstrap.png
site/static/bwr/angular-ui-tree/dist/angular-ui-tree.min.css
site/static/bwr/angular-ui-tree/dist/angular-ui-tree.min.js
site/static/bwr/angular/angular.min.js
@ -48,17 +43,51 @@ site/static/bwr/bootstrap/dist/fonts/glyphicons-halflings-regular.woff
site/static/bwr/bootstrap/dist/js/bootstrap.min.js
site/static/bwr/es5-shim/es5-shim.min.js
site/static/bwr/jquery/dist/jquery.min.js
site/static/catAndAppList.html
site/static/custom.png
site/static/dark.png
site/static/en.json
site/static/en.png
site/static/file.html
site/static/fr.json
site/static/fr.png
site/static/home.html
site/static/impact.png
site/static/int.html
site/static/css/manager.css
site/static/forms/authParams.html
site/static/forms/blackWhiteList.html
site/static/forms/bool.html
site/static/forms/boolOrExpr.html
site/static/forms/catAndAppList.html
site/static/forms/file.html
site/static/forms/home.html
site/static/forms/int.html
site/static/forms/keyText.html
site/static/forms/keyTextContainer.html
site/static/forms/longtext.html
site/static/forms/menuApp.html
site/static/forms/menuCat.html
site/static/forms/oidcmetadatajson.html
site/static/forms/oidcmetadatajwks.html
site/static/forms/oidcOPMetaDataNode.html
site/static/forms/oidcOPMetaDataNodeContainer.html
site/static/forms/oidcRPMetaDataNode.html
site/static/forms/oidcRPMetaDataNodeContainer.html
site/static/forms/password.html
site/static/forms/portalskin.html
site/static/forms/post.html
site/static/forms/postContainer.html
site/static/forms/README.md
site/static/forms/restore.html
site/static/forms/RSAKey.html
site/static/forms/RSAKeyNoPassword.html
site/static/forms/rule.html
site/static/forms/ruleContainer.html
site/static/forms/samlAssertion.html
site/static/forms/samlAttribute.html
site/static/forms/samlAttributeContainer.html
site/static/forms/samlIDPMetaDataNode.html
site/static/forms/samlIDPMetaDataNodeContainer.html
site/static/forms/samlService.html
site/static/forms/samlSPMetaDataNode.html
site/static/forms/samlSPMetaDataNodeContainer.html
site/static/forms/select.html
site/static/forms/simpleInputContainer.html
site/static/forms/text.html
site/static/forms/trool.html
site/static/forms/virtualHost.html
site/static/forms/virtualHostContainer.html
site/static/forms/white.html
site/static/js/conftree.js
site/static/js/filterFunctions.js
site/static/js/llApp.js
@ -66,49 +95,20 @@ site/static/js/manager.js
site/static/js/notifications.js
site/static/js/sessions.js
site/static/js/ui-bootstrap-tpls-0.12.1.min.js
site/static/keyText.html
site/static/keyTextContainer.html
site/static/llng-icon-32.png
site/static/llng-icon-48.png
site/static/llng-icon.ico
site/static/llng.png
site/static/longtext.html
site/static/manager.css
site/static/menuApp.html
site/static/menuCat.html
site/static/oidcmetadatajson.html
site/static/oidcmetadatajwks.html
site/static/oidcOPMetaDataNode.html
site/static/oidcOPMetaDataNodeContainer.html
site/static/oidcRPMetaDataNode.html
site/static/oidcRPMetaDataNodeContainer.html
site/static/password.html
site/static/pastel.png
site/static/portalskin.html
site/static/post.html
site/static/postContainer.html
site/static/README.md
site/static/restore.html
site/static/RSAKey.html
site/static/RSAKeyNoPassword.html
site/static/rule.html
site/static/ruleContainer.html
site/static/samlAssertion.html
site/static/samlAttribute.html
site/static/samlAttributeContainer.html
site/static/samlIDPMetaDataNode.html
site/static/samlIDPMetaDataNodeContainer.html
site/static/samlService.html
site/static/samlSPMetaDataNode.html
site/static/samlSPMetaDataNodeContainer.html
site/static/select.html
site/static/simpleInputContainer.html
site/static/languages/en.json
site/static/languages/fr.json
site/static/logos/bootstrap.png
site/static/logos/custom.png
site/static/logos/dark.png
site/static/logos/en.png
site/static/logos/fr.png
site/static/logos/impact.png
site/static/logos/llng-icon-32.png
site/static/logos/llng-icon-48.png
site/static/logos/llng-icon.ico
site/static/logos/llng.png
site/static/logos/pastel.png
site/static/struct.json
site/static/text.html
site/static/trool.html
site/static/virtualHost.html
site/static/virtualHostContainer.html
site/static/white.html
site/templates/footer.tpl
site/templates/header.tpl
site/templates/manager.tpl
@ -117,20 +117,20 @@ site/templates/notifications.tpl
site/templates/scripts.tpl
site/templates/sessions.tpl
site/templates/tree.tpl
t/01-base-tree.json
t/02-base-tree-all-nodes-opened.json
t/02-HTML-template.t
t/03-HTML-forms.t
t/05-rest-api.t
t/06-rest-api.t
t/10-save-unchanged-conf.t
t/12-modified.json
t/12-save-changed-conf.t
t/40-sessions.t
t/50-notifications.t
t/90-translations.t
t/99-pod.t
t/conf/lmConf-1.js
t/jsonfiles/01-base-tree.json
t/jsonfiles/02-base-tree-all-nodes-opened.json
t/jsonfiles/12-modified.json
t/lemonldap-ng.ini
t/lmConf-1.js
t/test-lib.pm
TODO.md

View File

@ -41,7 +41,7 @@ sub init {
# TODO: manage errors
unless ( -r $self->{templateDir} ) {
$self->error("Unable to read $self->{template}");
$self->error("Unable to read $self->{templateDir}");
return 0;
}

View File

@ -81,7 +81,7 @@ sub notifAccess {
# TODO: old parameters (with table)
unless ( $self->{notificationStorage} ) {
$self->abort( notifications =>
$self->routerAbort( notifications =>
'notificationStorage is not defined in configuration' );
return 0;
}
@ -96,7 +96,7 @@ sub notifAccess {
# If type not File or DBI, abort
unless ( $args->{type} =~ /^(File|DBI|LDAP)$/ ) {
$self->abort( notifications =>
$self->routerAbort( notifications =>
"Only File, DBI or LDAP supported for Notifications" );
return 0;
}
@ -106,7 +106,7 @@ sub notifAccess {
unless (
$self->_notifAccess( Lemonldap::NG::Common::Notification->new($args) ) )
{
$self->abort(
$self->routerAbort(
notifications => $Lemonldap::NG::Common::Notification::msg );
return 0;
}

View File

@ -5,13 +5,13 @@ use JSON;
use strict;
use 5.10.0;
require 'test/test-lib.pm';
require 't/test-lib.pm';
my $res;
ok( $res = get('/'), 'Succeed to get /' );
my %hdrs = @{ $res->[1] };
ok( $res->[0] == 200, 'Return a 200 code' );
ok( $res->[0] == 200, 'Return a 200 code' ) or print STDERR "Received".Dumper($res);
ok( $hdrs{'Content-Type'} =~ /text\/html$/i, 'Content is declared as HTML' );
ok( $res->[2]->[0] =~ /<html/si, 'It contains a html tag' );

View File

@ -4,7 +4,7 @@ use Test::More;
use strict;
use 5.10.0;
my $formDir = 'app/forms';
my $formDir = 'site/static/forms';
my $count = 0;
use_ok('Lemonldap::NG::Manager::Tree');

View File

@ -5,8 +5,8 @@ use JSON;
use strict;
use 5.10.0;
require 'test/test-lib.pm';
my $struct = 'app/struct.json';
require 't/test-lib.pm';
my $struct = 'site/static/struct.json';
my @bad = qw(
/conf/latest

View File

@ -5,7 +5,7 @@ use 5.10.0;
use strict;
use JSON;
use IO::String;
require 'test/test-lib.pm';
require 't/test-lib.pm';
my $res;
ok(

View File

@ -5,12 +5,12 @@ use 5.10.0;
use strict;
use JSON;
use Data::Dumper;
require 'test/test-lib.pm';
require 't/test-lib.pm';
my @struct =
qw[test/jsonfiles/01-base-tree.json test/jsonfiles/02-base-tree-all-nodes-opened.json];
qw[t/jsonfiles/01-base-tree.json t/jsonfiles/02-base-tree-all-nodes-opened.json];
my @desc = ( 'Unopened conf', 'Unchanged conf with all nodes opened' );
my $confFiles = [ 'test/conf/lmConf-1.js', 'test/conf/lmConf-2.js' ];
my $confFiles = [ 't/conf/lmConf-1.js', 't/conf/lmConf-2.js' ];
sub body {
return 0 unless (@struct);

View File

@ -5,10 +5,10 @@ use 5.10.0;
use strict;
use JSON;
use Data::Dumper;
require 'test/test-lib.pm';
require 't/test-lib.pm';
my $struct = 'test/jsonfiles/12-modified.json';
my $confFiles = [ 'test/conf/lmConf-1.js', 'test/conf/lmConf-2.js' ];
my $struct = 't/jsonfiles/12-modified.json';
my $confFiles = [ 't/conf/lmConf-1.js', 't/conf/lmConf-2.js' ];
sub body {
return IO::File->new( $struct, 'r' );

View File

@ -4,11 +4,10 @@ use Test::More;
use strict;
use 5.10.0;
use Lemonldap::NG::Common::Session;
use Data::Dumper;
eval { mkdir 'test/sessions' };
`rm -rf test/sessions/*`;
require 'test/test-lib.pm';
eval { mkdir 't/sessions' };
`rm -rf t/sessions/*`;
require 't/test-lib.pm';
sub newSession {
my ( $uid, $ip ) = splice @_;
@ -18,7 +17,7 @@ sub newSession {
{
storageModule => 'Apache::Session::File',
storageModuleOptions => {
Directory => 'test/sessions',
Directory => 't/sessions',
generateModule =>
'Lemonldap::NG::Common::Apache::Session::Generate::SHA256',
},
@ -151,7 +150,7 @@ foreach (@ids) {
count(3);
}
opendir D, 'test/sessions' or die 'Unknown dir';
opendir D, 't/sessions' or die 'Unknown dir';
my @files = grep { not /^\./ } readdir D;
ok( @files == 0, "Session directory is empty" );
count(1);

View File

@ -4,11 +4,10 @@ use Test::More;
use strict;
use 5.10.0;
use IO::String;
use Data::Dumper;
eval { mkdir 'test/notifications' };
`rm -rf test/notifications/*`;
require 'test/test-lib.pm';
eval { mkdir 't/notifications' };
`rm -rf t/notifications/*`;
require 't/test-lib.pm';
# Try to create a notification
my $notif =
@ -50,7 +49,7 @@ count(2);
#print STDERR Dumper($res);
`rm -f test/notifications/*`;
`rm -f t/notifications/*`;
done_testing( count() );

View File

@ -5,7 +5,7 @@ use JSON;
use strict;
use 5.10.0;
my $langDir = 'app/languages';
my $langDir = 'site/static/languages';
my $count = 0;
use_ok('Lemonldap::NG::Manager::Tree');
@ -86,7 +86,7 @@ $count += 2;
ok(
open( F,
q#perl -ne 'print if(s/.*trspan="(\w+)".*/$1/g)' pl/manager.tpl app/forms/*|sort -u|#
q#perl -ne 'print if(s/.*trspan="(\w+)".*/$1/g)' site/templates/manager.tpl site/static/forms/*|sort -u|#
),
'Find HTML docs'
);

View File

@ -109,7 +109,7 @@
},
"globalStorage": "Apache::Session::File",
"globalStorageOptions": {
"Directory": "test/sessions",
"Directory": "t/sessions",
"generateModule": "Lemonldap::NG::Common::Apache::Session::Generate::SHA256"
},
"groups": {},
@ -134,7 +134,7 @@
"notification": 1,
"notificationStorage": "File",
"notificationStorageOptions": {
"dirName": "test/notifications"
"dirName": "t/notifications"
},
"passwordDB": "Demo",
"persistentStorage": "Apache::Session::File",
@ -150,4 +150,4 @@
"timeout": 72000,
"userDB": "Demo",
"whatToTrace": "_whatToTrace"
}
}

View File

@ -1158,7 +1158,7 @@
}, {
"cnodes": "globalStorageOptions",
"default": [{
"data": "test/sessions",
"data": "t/sessions",
"id": "globalStorageOptions/Directory",
"title": "Directory",
"type": "keyText"

View File

@ -1314,7 +1314,7 @@
"data": "Apache::Session::File"
}, {
"default": [{
"data": "test/sessions",
"data": "t/sessions",
"id": "globalStorageOptions/Directory",
"title": "Directory",
"type": "keyText"
@ -1333,7 +1333,7 @@
"title": "globalStorageOptions",
"type": "keyTextContainer",
"nodes": [{
"data": "test/sessions",
"data": "t/sessions",
"title": "Directory",
"type": "keyText",
"id": "globalStorageOptions/Directory"
@ -1525,7 +1525,7 @@
"title": "dirName",
"type": "keyText",
"id": "notificationStorageOptions/dirName",
"data": "test/notifications"
"data": "t/notifications"
}]
}, {
"default": "allusers",

View File

@ -1344,7 +1344,7 @@
"title": "globalStorageOptions",
"type": "keyTextContainer",
"nodes": [{
"data": "test/sessions",
"data": "t/sessions",
"title": "Directory",
"type": "keyText",
"id": "globalStorageOptions/Directory"
@ -1536,7 +1536,7 @@
"title": "dirName",
"type": "keyText",
"id": "notificationStorageOptions/dirName",
"data": "test/notifications"
"data": "t/notifications"
}]
}, {
"default": "allusers",

View File

@ -3,7 +3,7 @@
[configuration]
type=File
dirName=test/conf
dirName=t/conf
[portal]
@ -23,7 +23,7 @@ protection = manager
logLevel = error
staticPrefix = app/
languages = fr, en
templateDir = pl/
templateDir = site/templates/
[sessionsExplorer]

View File

@ -2,6 +2,7 @@
use JSON;
use 5.10.0;
use Data::Dumper;
use_ok('Lemonldap::NG::Manager');
@ -10,14 +11,16 @@ my $app;
ok(
$app = Lemonldap::NG::Manager->run(
{
configStorage => { confFile => 'test/lemonldap-ng.ini' },
configStorage => { confFile => 't/lemonldap-ng.ini' },
protection => 'none',
}
),
'New app'
);
our $count = 2;
ok( ref($app) eq 'CODE', 'app is a subroutine' );
our $count = 3;
sub count {
my $c = shift;
@ -149,8 +152,10 @@ sub jsonResponse {
sub jsonPostResponse {
my ( $path, $query, $body, $type, $len ) = splice @_;
my $res;
ok( $res = post( $path, $query, $body, $type, $len ),
"Succeed to post to $path" . ( $query ? "?$query" : "" ) );
ok(
$res = post( $path, $query, $body, $type, $len ),
"Succeed to post to $path" . ( $query ? "?$query" : "" )
);
ok( $res->[0] == 200, "Return code eq 200" ) or print STDERR Dumper($res);
my $href;
ok( $href = decode_json( $res->[2]->[0] ), 'Response is JSON' );
@ -161,8 +166,10 @@ sub jsonPostResponse {
sub jsonPutResponse {
my ( $path, $query, $body, $type, $len ) = splice @_;
my $res;
ok( $res = put( $path, $query, $body, $type, $len ),
"Succeed to post to $path" . ( $query ? "?$query" : "" ) );
ok(
$res = put( $path, $query, $body, $type, $len ),
"Succeed to post to $path" . ( $query ? "?$query" : "" )
);
ok( $res->[0] == 200, "Return code eq 200" ) or print STDERR Dumper($res);
my $href;
ok( $href = decode_json( $res->[2]->[0] ), 'Response is JSON' );