diff --git a/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t b/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t index cd501dcee..d859e6dee 100644 --- a/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t +++ b/lemonldap-ng-portal/t/40-Notifications-JSON-DBI.t @@ -31,6 +31,21 @@ q{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00',?,nul "text": "This is a test text", "check": ["Accept test"] } +]' + ); +$dbh->prepare( +q{INSERT INTO notifications VALUES ('dwho','testref2','2016-05-30 00:00:00',?,null,null)} + )->execute( + '[ +{ + "uid": "dwho", + "date": "2016-05-30", + "reference": "testref2", + "title": "Test2 title", + "subtitle": "Test2 subtitle", + "text": "This is a second test text", + "check": ["Accept test"] +} ]' ); @@ -91,9 +106,9 @@ q{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00',?,nul ); expectOK($res); - # Try to validate notification + # Try to validate notifications $str = -'reference1x1=testref&check1x1x1=accepted&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw=='; +'reference1x1=testref&check1x1x1=accepted&reference1x2=testref2&check1x2x1=accepted&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw=='; ok( $res = $client->_post( '/notifback', @@ -102,7 +117,7 @@ q{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00',?,nul accept => 'text/html', length => length($str), ), - "Accept notification" + "Accept notifications" ); expectRedirection( $res, 'http://test1.example.com/' ); @@ -112,7 +127,7 @@ q{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00',?,nul $sth->execute; my $i = 0; while ( $sth->fetchrow_hashref ) { $i++ } - ok( $i == 1, 'Notification was deleted' ); + ok( $i == 2, 'Notification was deleted' ); clean_sessions(); diff --git a/lemonldap-ng-portal/t/40-Notifications-XML-DBI.t b/lemonldap-ng-portal/t/40-Notifications-XML-DBI.t index ec9ceaec3..1d406743f 100644 --- a/lemonldap-ng-portal/t/40-Notifications-XML-DBI.t +++ b/lemonldap-ng-portal/t/40-Notifications-XML-DBI.t @@ -30,6 +30,15 @@ qq{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00','Test subtitle This is a test text Accept test +',null,null)} + ); + $dbh->do( +qq{INSERT INTO notifications VALUES ('dwho','testref2','2016-05-30 00:00:00',' + +Test2 title +Test2 subtitle +This is a second test text +Accept test ',null,null)} ); @@ -90,9 +99,9 @@ qq{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00','_post( '/notifback', @@ -101,7 +110,7 @@ qq{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00',' 'text/html', length => length($str), ), - "Accept notification" + "Accept notifications" ); expectRedirection( $res, 'http://test1.example.com/' ); @@ -111,7 +120,7 @@ qq{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00','execute; my $i = 0; while ( $sth->fetchrow_hashref ) { $i++ } - ok( $i == 1, 'Notification was deleted' ); + ok( $i == 2, 'Notification was deleted' ); clean_sessions();