Moar tests

This commit is contained in:
swagg boi 2022-11-28 15:31:56 -05:00
parent f7030968d3
commit 4b6b0149bc

View file

@ -17,16 +17,24 @@ my %invalid_login = (
subtest Login => sub { subtest Login => sub {
$t->get_ok('/login') $t->get_ok('/login')
->status_is(200) ->status_is(200)
->element_exists('form input[name="email"]')
->element_exists('form input[name="password"]')
->text_like(h2 => qr/Moderator Login/); ->text_like(h2 => qr/Moderator Login/);
$t->post_ok('/login', form => \%invalid_login) $t->post_ok('/login', form => \%invalid_login)
->status_is(403) ->status_is(403)
->element_exists('form input[name="email"]')
->element_exists('form input[name="password"]')
->text_like(p => qr/Invalid login/); ->text_like(p => qr/Invalid login/);
$t->post_ok('/login', form => \%valid_login) $t->post_ok('/login', form => \%valid_login)
->status_is(302) ->status_is(302)
->header_like(Location => qr{moderator/list}); ->header_like(Location => qr{moderator/list});
$t->get_ok('/moderator/list')
->status_is(200)
->text_like(h2 => qr/Top Secret/);
$t->get_ok('/logout') $t->get_ok('/logout')
->status_is(302) ->status_is(302)
->header_like(Location => qr{thread/list}); ->header_like(Location => qr{thread/list});