diff --git a/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t b/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t
index 6aa1d42bc..ba8e40090 100644
--- a/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t
+++ b/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t
@@ -1,9 +1,10 @@
use Test::More;
use strict;
use IO::String;
+use JSON qw(from_json);
my $res;
-my $maintests = 10;
+my $maintests = 17;
require 't/test-lib.pm';
my $file = tempdb();
@@ -105,7 +106,8 @@ q{INSERT INTO notifications VALUES ('rtyler','testref2','2050-05-30 00:00:00',?,
notificationStorageOptions => {
dbiChain => "dbi:SQLite:dbname=$file",
},
- oldNotifFormat => 0,
+ oldNotifFormat => 0,
+ notificationsExplorer => 1,
}
}
);
@@ -179,7 +181,7 @@ q{INSERT INTO notifications VALUES ('rtyler','testref2','2050-05-30 00:00:00',?,
!defined( $cookies->{lemonldappdata} ),
" Make sure no pdata is returned"
);
- $client->logout($id);
+ $id = expectCookie($res);
# Verify that notification was tagged as 'done'
my $sth =
@@ -189,6 +191,32 @@ q{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(
diff --git a/lemonldap-ng-portal/t/40-Notifications-XML-DBI.t b/lemonldap-ng-portal/t/40-Notifications-XML-DBI.t
index e7897e3d3..696a931ac 100644
--- a/lemonldap-ng-portal/t/40-Notifications-XML-DBI.t
+++ b/lemonldap-ng-portal/t/40-Notifications-XML-DBI.t
@@ -150,6 +150,7 @@ qq{INSERT INTO notifications VALUES ('rtyler','testref2','2050-05-30 00:00:00','
!defined( $cookies->{lemonldappdata} ),
" Make sure no pdata is returned"
);
+ $id = expectCookie($res);
$client->logout($id);
# Verify that notification was tagged as 'done'
diff --git a/lemonldap-ng-portal/t/40-Notifications-explorer-JSON-File.t b/lemonldap-ng-portal/t/40-Notifications-explorer-JSON-File.t
index e691d79cb..f3412e39e 100644
--- a/lemonldap-ng-portal/t/40-Notifications-explorer-JSON-File.t
+++ b/lemonldap-ng-portal/t/40-Notifications-explorer-JSON-File.t
@@ -29,9 +29,10 @@ my $client = LLNG::Manager::Test->new( {
notification => 1,
notificationStorage => 'File',
notificationStorageOptions => { dirName => $main::tmpDir },
+ portalMainLogo => 'common/logos/logo_llng_old.png',
oldNotifFormat => 0,
notificationsExplorer => 1,
- portalMainLogo => 'common/logos/logo_llng_old.png', }
+ }
}
);
@@ -82,8 +83,7 @@ expectForm( $res, undef, '/notifback', 'reference1x1' );
# Verify that cookie is ciphered (session unvalid)
ok(
$res = $client->_get(
- '/',
- cookie => "lemonldap=$id",
+ '/', cookie => "lemonldap=$id",
),
'Test cookie received'
);
diff --git a/lemonldap-ng-portal/t/40-Notifications-explorer-XML-File.t b/lemonldap-ng-portal/t/40-Notifications-explorer-XML-File.t
index fd16cf610..14e4cdf68 100644
--- a/lemonldap-ng-portal/t/40-Notifications-explorer-XML-File.t
+++ b/lemonldap-ng-portal/t/40-Notifications-explorer-XML-File.t
@@ -7,7 +7,7 @@ require 't/test-lib.pm';
my $res;
my $file = "$main::tmpDir/20160530_dwho_dGVzdHJlZg==.xml";
-my $maintests = 34;
+my $maintests = 36;
SKIP: {
eval { require XML::LibXML; require XML::LibXSLT; };
@@ -23,6 +23,12 @@ SKIP: {