Commit 300b68cb authored by Christophe Maudoux's avatar Christophe Maudoux

Improve unit tests (#1515 & #1522)

parent 2f4f7bd7
......@@ -16,7 +16,7 @@ print F '[
"title": "Test title",
"subtitle": "Test subtitle",
"text": "This is a test text",
"check": ["Accept test"]
"check": ["Accept test","Accept test2"]
}
]';
close F;
......@@ -30,6 +30,7 @@ my $client = LLNG::Manager::Test->new(
notificationStorage => 'File',
notificationStorageOptions => { dirName => 't' },
oldNotifFormat => 0,
portalMainLogo => 'common/logos/test.png',
}
}
);
......@@ -78,6 +79,11 @@ ok( $res->[2]->[0] =~ qr%<h2 class="notifText">Test title</h2>%,
or print STDERR Dumper( $res->[2]->[0] );
count(2);
ok( $res->[2]->[0] =~ qr%<img src="/static/common/logos/test.png"%,
'Found custom Main Logo' )
or print STDERR Dumper( $res->[2]->[0] );
count(1);
# Try to validate notification without accepting it
$str = 'reference1x1=testref&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==';
ok( $res = $client->_post(
......@@ -110,9 +116,26 @@ ok( $res->[2]->[0] =~ qr%<h2 class="notifText">Test title</h2>%,
or print STDERR Dumper( $res->[2]->[0] );
count(2);
# Try to validate notification
# Try to validate notification with accepting just one checkbox
$str
= 'reference1x1=testref&check1x1x1=accepted&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==';
ok( $res = $client->_post(
'/notifback',
IO::String->new($str),
cookie => "lemonldap=$id",
accept => 'text/html',
length => length($str),
),
"Don't accept notification - Accept just one checkbox"
);
ok( $res->[2]->[0] =~ qr%<h2 class="notifText">Test title</h2>%,
'Notification displayed' )
or print STDERR Dumper( $res->[2]->[0] );
count(2);
# Try to validate notification with accepting all checkboxes
$str
= 'reference1x1=testref&check1x1x1=accepted&check1x1x2=accepted&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==';
ok( $res = $client->_post(
'/notifback',
IO::String->new($str),
......
......@@ -6,7 +6,7 @@ require 't/test-lib.pm';
my $res;
my $file = 't/20160530_dwho_dGVzdHJlZg==.xml';
my $maintests = 12;
my $maintests = 15;
SKIP: {
eval { require XML::LibXML; require XML::LibXSLT; };
......@@ -21,6 +21,7 @@ SKIP: {
<subtitle>Test subtitle</subtitle>
<text>This is a test text</text>
<check>Accept test</check>
<check>Accept test2</check>
</notification></root>';
close F;
......@@ -33,6 +34,7 @@ SKIP: {
notificationStorage => 'File',
notificationStorageOptions => { dirName => 't' },
oldNotifFormat => 1,
portalMainLogo => 'common/logos/test.png',
}
}
);
......@@ -77,6 +79,9 @@ SKIP: {
ok( $res->[2]->[0] =~ qr%<h2 class="notifText">Test title</h2>%,
'Notification displayed' )
or print STDERR Dumper( $res->[2]->[0] );
ok( $res->[2]->[0] =~ qr%<img src="/static/common/logos/test.png"%,
'Found custom Main Logo' )
or print STDERR Dumper( $res->[2]->[0] );
# Try to validate notification without accepting it
$str = 'reference1x1=testref&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==';
......@@ -108,9 +113,25 @@ SKIP: {
'Notification displayed' )
or print STDERR Dumper( $res->[2]->[0] );
# Try to validate notification
# Try to validate notification with accepting just one checkbox
$str
= 'reference1x1=testref&check1x1x1=accepted&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==';
ok( $res = $client->_post(
'/notifback',
IO::String->new($str),
cookie => "lemonldap=$id",
accept => 'text/html',
length => length($str),
),
"Don't accept notification - Accept just one checkbox"
);
ok( $res->[2]->[0] =~ qr%<h2 class="notifText">Test title</h2>%,
'Notification displayed' )
or print STDERR Dumper( $res->[2]->[0] );
# Try to validate notification with accepting all ckeckboxes
$str
= 'reference1x1=testref&check1x1x1=accepted&check1x1x2=accepted&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==';
ok( $res = $client->_post(
'/notifback',
IO::String->new($str),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment