Improve unit test & Make manifest (#2071)

This commit is contained in:
Christophe Maudoux 2020-02-12 23:33:46 +01:00
parent 04912c7854
commit 964afdb011
7 changed files with 42 additions and 5 deletions

View File

@ -85,4 +85,3 @@ t/lmConf-1.json
t/sessions/lock/Apache-Session-f5eec18ebb9bc96352595e2d8ce962e8ecf7af7c9a98cb9a43f9cd181cf4b545.lock
t/test-psgi-lib.pm
t/test.pm
t/Time-Fake.pm

View File

@ -26,6 +26,7 @@ lib/Lemonldap/NG/Manager/Conf/Parser.pm
lib/Lemonldap/NG/Manager/Conf/Tests.pm
lib/Lemonldap/NG/Manager/Conf/Zero.pm
lib/Lemonldap/NG/Manager/Notifications.pm
lib/Lemonldap/NG/Manager/Plugin.pm
lib/Lemonldap/NG/Manager/Sessions.pm
lib/Lemonldap/NG/Manager/Viewer.pm
Makefile.PL

View File

@ -164,6 +164,7 @@ site/coffee/idpchoice.coffee
site/coffee/info.coffee
site/coffee/kerberos.coffee
site/coffee/kerberosChoice.coffee
site/coffee/notifications.coffee
site/coffee/oidcchecksession.coffee
site/coffee/portal.coffee
site/coffee/redirect.coffee
@ -272,6 +273,7 @@ site/htdocs/static/common/icons/calendar.png
site/htdocs/static/common/icons/decryptValue.png
site/htdocs/static/common/icons/door_out.png
site/htdocs/static/common/icons/key.png
site/htdocs/static/common/icons/notifsExplorer.png
site/htdocs/static/common/icons/oidc.png
site/htdocs/static/common/icons/ok.png
site/htdocs/static/common/icons/sfa_manager.png
@ -307,6 +309,9 @@ site/htdocs/static/common/js/kerberos.min.js.map
site/htdocs/static/common/js/kerberosChoice.js
site/htdocs/static/common/js/kerberosChoice.min.js
site/htdocs/static/common/js/kerberosChoice.min.js.map
site/htdocs/static/common/js/notifications.js
site/htdocs/static/common/js/notifications.min.js
site/htdocs/static/common/js/notifications.min.js.map
site/htdocs/static/common/js/oidcchecksession.js
site/htdocs/static/common/js/oidcchecksession.min.js
site/htdocs/static/common/js/oidcchecksession.min.js.map
@ -401,6 +406,7 @@ site/templates/bootstrap/mail.tpl
site/templates/bootstrap/menu.tpl
site/templates/bootstrap/noHistory.tpl
site/templates/bootstrap/notification.tpl
site/templates/bootstrap/notifications.tpl
site/templates/bootstrap/oidcConsents.tpl
site/templates/bootstrap/oidcGiveConsent.tpl
site/templates/bootstrap/oidcLogout.tpl
@ -498,6 +504,7 @@ t/30-Auth-and-issuer-SAML-POST.t
t/30-Auth-and-issuer-SAML-Redirect-IdP-initiated.t
t/30-Auth-and-issuer-SAML-Redirect-MultipleSP-Missing-SLO.t
t/30-Auth-and-issuer-SAML-Redirect-MultipleSP.t
t/30-Auth-and-issuer-SAML-Redirect-With-Info.t
t/30-Auth-and-issuer-SAML-Redirect.t
t/30-Auth-SAML-with-choice.t
t/30-CDC.t
@ -565,9 +572,12 @@ t/37-SAML-SP-POST-to-CAS-server-with-Choice.t
t/37-SAML-SP-POST-to-CAS-server.t
t/37-SAML-SP-POST-to-OIDC-OP.t
t/38-No-persistent-session.t
t/40-Notifications-Explorer-JSON-File.t
t/40-Notifications-Explorer-XML-File.t
t/40-Notifications-JSON-DBI.t
t/40-Notifications-JSON-File-with-token.t
t/40-Notifications-JSON-File.t
t/40-Notifications-JSON-LDAP.t
t/40-Notifications-JSON-Server.t
t/40-Notifications-XML-DBI.t
t/40-Notifications-XML-File.t
@ -667,6 +677,7 @@ t/lib/Lemonldap/NG/Handler/Test.pm
t/lib/Lemonldap/NG/Portal/Auth/LDAPPolicy.pm
t/lib/Lemonldap/NG/Portal/Custom.pm
t/lmConf-1.json
t/oidc-lib.pm
t/pdata.pm
t/README.md
t/saml-lib.pm
@ -684,5 +695,4 @@ t/test-psgi.pm
t/testslapd/confs-sessions.ldif
t/testslapd/slapd.ldif
t/testslapd/users.ldif
t/Time-Fake.pm
t/vrfyOTP.pl

View File

@ -107,7 +107,7 @@ q{INSERT INTO notifications VALUES ('rtyler','testref2','2050-05-30 00:00:00',?,
dbiChain => "dbi:SQLite:dbname=$file",
},
oldNotifFormat => 0,
notificationsExplorer => 1,
notificationsExplorer => 1
}
}
);

View File

@ -1,9 +1,10 @@
use Test::More;
use strict;
use IO::String;
use JSON qw(from_json);
my $res;
my $maintests = 9;
my $maintests = 16;
require 't/test-lib.pm';
my $file = tempdb();
@ -80,6 +81,7 @@ qq{INSERT INTO notifications VALUES ('rtyler','testref2','2050-05-30 00:00:00','
dbiChain => "dbi:SQLite:dbname=$file",
},
oldNotifFormat => 1,
notificationsExplorer => 1
}
}
);
@ -151,7 +153,6 @@ qq{INSERT INTO notifications VALUES ('rtyler','testref2','2050-05-30 00:00:00','
" Make sure no pdata is returned"
);
$id = expectCookie($res);
$client->logout($id);
# Verify that notification was tagged as 'done'
my $sth =
@ -161,6 +162,32 @@ qq{INSERT INTO notifications VALUES ('rtyler','testref2','2050-05-30 00:00:00','
while ( $sth->fetchrow_hashref ) { $i++ }
ok( $i == 2, 'Notification was deleted' );
# GET notifications explorer
ok(
$res = $client->_get(
'/mynotifications', cookie => "lemonldap=$id",
),
'Notifications explorer query'
);
my $json;
ok( $json = eval { from_json( $res->[2]->[0] ) }, 'Response is JSON' )
or print STDERR "$@\n" . Dumper($res);
ok( $json->{result} == 2, ' Result is 2' )
or explain( $json, "result => 2" );
ok( $json->{MSG} == 'myNotifications', ' MSG is myNotifications' )
or explain( $json, "result => 2" );
ok( $json->{NOTIFICATIONS}->[0]->{reference} =~ /testref2?/,
' Notification 1 found' )
or explain( $json, "Notification 1" );
ok( $json->{NOTIFICATIONS}->[0]->{reference} =~ /testref2?/,
' Notification 2 found' )
or explain( $json, "Notification 2" );
ok( $json->{NOTIFICATIONS}->[0]->{epoch} =~ /\d{10}/, ' epoch found' )
or explain( $json, "Epoch found" );
$client->logout($id);
# Try to authenticate
# -------------------
ok(