From b16a722ab3553ce1e5a8983ee79fabf4fd27d841 Mon Sep 17 00:00:00 2001 From: swaggboi Date: Fri, 10 Dec 2021 17:02:42 -0500 Subject: [PATCH] Implement basic tests --- t/basic.t | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 t/basic.t diff --git a/t/basic.t b/t/basic.t new file mode 100644 index 0000000..899e984 --- /dev/null +++ b/t/basic.t @@ -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();