Implement basic tests

This commit is contained in:
swagg boi 2021-12-10 17:02:42 -05:00
parent 1768f7013d
commit b16a722ab3

30
t/basic.t Normal file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env perl
use Test::More;
use Mojo::File qw{curfile};
use Test::Mojo;
my $script = curfile->dirname->sibling('www-swagg.pl');
my $t = Test::Mojo->new($script);
my @routes = ('', 'ula6', 'die', 'me', 'news', 'portal');
my %guest_form = (
name => 'AliceTug',
location => 'Reston, VA',
message => 'Ayy... lmao'
);
# GET Requests
for my $route (@routes) {
$t->get_ok("/$route")->status_is(200)
}
# CGI Scripts
for my $script (qw{guest whoami}) {
$t->get_ok("/cgi-bin/$script.cgi")->status_is(200)
}
# ULA Tool
$t->get_ok('/ula6', form => {macaddr => 'ea:88:5e:3f:a3:34'})->status_is(200);
# POST Requests
$t->post_ok('/cgi-bin/guest.cgi', form => \%guest_form)->status_is(200);
done_testing();