Improve unit test (#1856)
This commit is contained in:
parent
36a547cba5
commit
b9aa198188
|
@ -31,6 +31,21 @@ q{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00',?,nul
|
||||||
"text": "This is a test text",
|
"text": "This is a test text",
|
||||||
"check": ["Accept test"]
|
"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);
|
expectOK($res);
|
||||||
|
|
||||||
# Try to validate notification
|
# Try to validate notifications
|
||||||
$str =
|
$str =
|
||||||
'reference1x1=testref&check1x1x1=accepted&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==';
|
'reference1x1=testref&check1x1x1=accepted&reference1x2=testref2&check1x2x1=accepted&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==';
|
||||||
ok(
|
ok(
|
||||||
$res = $client->_post(
|
$res = $client->_post(
|
||||||
'/notifback',
|
'/notifback',
|
||||||
|
@ -102,7 +117,7 @@ q{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00',?,nul
|
||||||
accept => 'text/html',
|
accept => 'text/html',
|
||||||
length => length($str),
|
length => length($str),
|
||||||
),
|
),
|
||||||
"Accept notification"
|
"Accept notifications"
|
||||||
);
|
);
|
||||||
expectRedirection( $res, 'http://test1.example.com/' );
|
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;
|
$sth->execute;
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
while ( $sth->fetchrow_hashref ) { $i++ }
|
while ( $sth->fetchrow_hashref ) { $i++ }
|
||||||
ok( $i == 1, 'Notification was deleted' );
|
ok( $i == 2, 'Notification was deleted' );
|
||||||
|
|
||||||
clean_sessions();
|
clean_sessions();
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,15 @@ qq{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00','<?x
|
||||||
<subtitle>Test subtitle</subtitle>
|
<subtitle>Test subtitle</subtitle>
|
||||||
<text>This is a test text</text>
|
<text>This is a test text</text>
|
||||||
<check>Accept test</check>
|
<check>Accept test</check>
|
||||||
|
</notification></root>',null,null)}
|
||||||
|
);
|
||||||
|
$dbh->do(
|
||||||
|
qq{INSERT INTO notifications VALUES ('dwho','testref2','2016-05-30 00:00:00','<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<root><notification uid="dwho" date="2016-05-30" reference="testref2">
|
||||||
|
<title>Test2 title</title>
|
||||||
|
<subtitle>Test2 subtitle</subtitle>
|
||||||
|
<text>This is a second test text</text>
|
||||||
|
<check>Accept test</check>
|
||||||
</notification></root>',null,null)}
|
</notification></root>',null,null)}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -90,9 +99,9 @@ qq{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00','<?x
|
||||||
);
|
);
|
||||||
expectOK($res);
|
expectOK($res);
|
||||||
|
|
||||||
# Try to validate notification
|
# Try to validate notifications
|
||||||
$str =
|
$str =
|
||||||
'reference1x1=testref&check1x1x1=accepted&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==';
|
'reference1x1=testref&check1x1x1=accepted&reference1x2=testref2&check1x2x1=accepted&url=aHR0cDovL3Rlc3QxLmV4YW1wbGUuY29tLw==';
|
||||||
ok(
|
ok(
|
||||||
$res = $client->_post(
|
$res = $client->_post(
|
||||||
'/notifback',
|
'/notifback',
|
||||||
|
@ -101,7 +110,7 @@ qq{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00','<?x
|
||||||
accept => 'text/html',
|
accept => 'text/html',
|
||||||
length => length($str),
|
length => length($str),
|
||||||
),
|
),
|
||||||
"Accept notification"
|
"Accept notifications"
|
||||||
);
|
);
|
||||||
expectRedirection( $res, 'http://test1.example.com/' );
|
expectRedirection( $res, 'http://test1.example.com/' );
|
||||||
|
|
||||||
|
@ -111,7 +120,7 @@ qq{INSERT INTO notifications VALUES ('dwho','testref','2016-05-30 00:00:00','<?x
|
||||||
$sth->execute;
|
$sth->execute;
|
||||||
my $i = 0;
|
my $i = 0;
|
||||||
while ( $sth->fetchrow_hashref ) { $i++ }
|
while ( $sth->fetchrow_hashref ) { $i++ }
|
||||||
ok( $i == 1, 'Notification was deleted' );
|
ok( $i == 2, 'Notification was deleted' );
|
||||||
|
|
||||||
clean_sessions();
|
clean_sessions();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user