2021-12-04 08:06:03 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
2021-12-19 04:46:20 +00:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
2021-12-04 08:06:03 +00:00
|
|
|
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);
|
2021-12-12 00:01:43 +00:00
|
|
|
my %form = (
|
|
|
|
name => 'swagg boi',
|
2022-01-01 04:45:21 +00:00
|
|
|
url => 'http://localhost',
|
2021-12-19 04:42:20 +00:00
|
|
|
message => 'Ayy... lmao',
|
2021-12-20 03:43:42 +00:00
|
|
|
answer => 'false'
|
2021-12-12 00:01:43 +00:00
|
|
|
);
|
|
|
|
|
2022-01-09 03:01:51 +00:00
|
|
|
$t->ua->max_redirects(1);
|
|
|
|
|
2021-12-19 04:42:20 +00:00
|
|
|
$t->get_ok('/')->status_is(200)
|
2021-12-20 03:43:42 +00:00
|
|
|
->text_is(h2 => 'Messages from the World Wide Web');
|
2022-01-12 20:18:34 +00:00
|
|
|
$t->get_ok('/spam')->status_is(200)
|
|
|
|
->text_is(h2 => 'Messages from the World Wide Web');
|
2021-12-20 03:43:42 +00:00
|
|
|
$t->get_ok('/sign')->status_is(200)->text_is(h2 => 'Sign the Guestbook');
|
2022-01-09 03:01:51 +00:00
|
|
|
$t->post_ok('/sign', form => \%form)->status_is(200);
|
2021-12-04 08:06:03 +00:00
|
|
|
|
|
|
|
done_testing();
|