diff --git a/Makefile b/Makefile index e63820dce..9e9ec2d27 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Notification/File.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Notification/File.pm index 0ca6ee579..5e51fa97d 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Notification/File.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Notification/File.pm @@ -86,7 +86,7 @@ sub getAll { date => $1, uid => $2, ref => decode_base64($3), - condition => decode_base64($4) + condition => decode_base64( $4 // '' ) } ) : () diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/PSGI/Router.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/PSGI/Router.pm index bea005c49..75815ad70 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/PSGI/Router.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/PSGI/Router.pm @@ -77,7 +77,7 @@ sub genRoute { } } -sub abort { +sub routerAbort { my ( $self, $path, $msg ) = splice @_; delete $self->routes->{$path}; $self->addRoute( diff --git a/lemonldap-ng-manager/MANIFEST b/lemonldap-ng-manager/MANIFEST index 363bbf04c..26051d7b6 100644 --- a/lemonldap-ng-manager/MANIFEST +++ b/lemonldap-ng-manager/MANIFEST @@ -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 diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm index 3fc3755c9..6a4b9b9b2 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager.pm @@ -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; } diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Notifications.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Notifications.pm index 8375c73f8..a2e011d83 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Notifications.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Notifications.pm @@ -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; } diff --git a/lemonldap-ng-manager/t/02-HTML-template.t b/lemonldap-ng-manager/t/02-HTML-template.t index 03ad9c7af..7b7df4701 100644 --- a/lemonldap-ng-manager/t/02-HTML-template.t +++ b/lemonldap-ng-manager/t/02-HTML-template.t @@ -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] =~ /new( $struct, 'r' ); diff --git a/lemonldap-ng-manager/t/40-sessions.t b/lemonldap-ng-manager/t/40-sessions.t index 401ecc65e..c47fa5f4b 100644 --- a/lemonldap-ng-manager/t/40-sessions.t +++ b/lemonldap-ng-manager/t/40-sessions.t @@ -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); diff --git a/lemonldap-ng-manager/t/50-notifications.t b/lemonldap-ng-manager/t/50-notifications.t index aee4fe597..85e35626b 100644 --- a/lemonldap-ng-manager/t/50-notifications.t +++ b/lemonldap-ng-manager/t/50-notifications.t @@ -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() ); diff --git a/lemonldap-ng-manager/t/90-translations.t b/lemonldap-ng-manager/t/90-translations.t index 94c2490ac..88ab096ec 100644 --- a/lemonldap-ng-manager/t/90-translations.t +++ b/lemonldap-ng-manager/t/90-translations.t @@ -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' ); diff --git a/lemonldap-ng-manager/t/lmConf-1.js b/lemonldap-ng-manager/t/conf/lmConf-1.js similarity index 98% rename from lemonldap-ng-manager/t/lmConf-1.js rename to lemonldap-ng-manager/t/conf/lmConf-1.js index dd3fee438..4964e74d5 100644 --- a/lemonldap-ng-manager/t/lmConf-1.js +++ b/lemonldap-ng-manager/t/conf/lmConf-1.js @@ -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" -} \ No newline at end of file +} diff --git a/lemonldap-ng-manager/t/01-base-tree.json b/lemonldap-ng-manager/t/jsonfiles/01-base-tree.json similarity index 99% rename from lemonldap-ng-manager/t/01-base-tree.json rename to lemonldap-ng-manager/t/jsonfiles/01-base-tree.json index 85f1706fb..b9753e7d6 100644 --- a/lemonldap-ng-manager/t/01-base-tree.json +++ b/lemonldap-ng-manager/t/jsonfiles/01-base-tree.json @@ -1158,7 +1158,7 @@ }, { "cnodes": "globalStorageOptions", "default": [{ - "data": "test/sessions", + "data": "t/sessions", "id": "globalStorageOptions/Directory", "title": "Directory", "type": "keyText" diff --git a/lemonldap-ng-manager/t/02-base-tree-all-nodes-opened.json b/lemonldap-ng-manager/t/jsonfiles/02-base-tree-all-nodes-opened.json similarity index 99% rename from lemonldap-ng-manager/t/02-base-tree-all-nodes-opened.json rename to lemonldap-ng-manager/t/jsonfiles/02-base-tree-all-nodes-opened.json index 723a0db5a..192895217 100644 --- a/lemonldap-ng-manager/t/02-base-tree-all-nodes-opened.json +++ b/lemonldap-ng-manager/t/jsonfiles/02-base-tree-all-nodes-opened.json @@ -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", diff --git a/lemonldap-ng-manager/t/12-modified.json b/lemonldap-ng-manager/t/jsonfiles/12-modified.json similarity index 99% rename from lemonldap-ng-manager/t/12-modified.json rename to lemonldap-ng-manager/t/jsonfiles/12-modified.json index b3a89a7b9..986f6c5cc 100644 --- a/lemonldap-ng-manager/t/12-modified.json +++ b/lemonldap-ng-manager/t/jsonfiles/12-modified.json @@ -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", diff --git a/lemonldap-ng-manager/t/lemonldap-ng.ini b/lemonldap-ng-manager/t/lemonldap-ng.ini index 66061e775..80db82dd6 100644 --- a/lemonldap-ng-manager/t/lemonldap-ng.ini +++ b/lemonldap-ng-manager/t/lemonldap-ng.ini @@ -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] diff --git a/lemonldap-ng-manager/t/test-lib.pm b/lemonldap-ng-manager/t/test-lib.pm index 7737f88ff..91c4abdfa 100644 --- a/lemonldap-ng-manager/t/test-lib.pm +++ b/lemonldap-ng-manager/t/test-lib.pm @@ -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' );