2022-04-08 17:47:33 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
use Mojo::File qw{curfile};
|
|
|
|
use Test::Mojo;
|
|
|
|
|
|
|
|
my $script = curfile->dirname->sibling('guestbook-ng.pl');
|
|
|
|
my $t = Test::Mojo->new($script);
|
|
|
|
|
|
|
|
$t->ua->max_redirects(0);
|
|
|
|
|
|
|
|
# This one is not spam
|
2022-07-27 02:09:36 +00:00
|
|
|
$t->get_ok('/message/3')->status_is(200)
|
2022-04-08 17:47:33 +00:00
|
|
|
->text_is(h2 => 'Messages from the World Wide Web');
|
|
|
|
# This one _is_ spam
|
2022-07-27 02:09:36 +00:00
|
|
|
$t->get_ok('/message/2')->status_is(200)
|
2022-04-08 17:47:33 +00:00
|
|
|
->text_is(h2 => 'Messages from the World Wide Web');
|
|
|
|
# This one is deleted
|
|
|
|
$t->get_ok('/message/1')->status_is(404)
|
|
|
|
->text_is(h2 => 'Messages from the World Wide Web');
|
|
|
|
|
|
|
|
done_testing();
|