Fix logging out and tests

This commit is contained in:
swagg boi 2023-01-10 00:45:31 -05:00
parent 936ec902b5
commit 2681360352
2 changed files with 15 additions and 7 deletions

View file

@ -79,7 +79,7 @@ sub login($self) {
} }
sub logout($self) { sub logout($self) {
delete $self->session->{'mod_id'}; delete $self->session->%{qw(mod_id is_admin)};
$self->flash(info => 'Logged out successfully 👋'); $self->flash(info => 'Logged out successfully 👋');

View file

@ -82,6 +82,7 @@ subtest Login => sub {
->text_like(h2 => qr/Flagged Posts/) ->text_like(h2 => qr/Flagged Posts/)
->element_exists('a[href*="/moderator/flagged"]') ->element_exists('a[href*="/moderator/flagged"]')
->element_exists('a[href*="/moderator/hidden"]' ) ->element_exists('a[href*="/moderator/hidden"]' )
->element_exists('a[href*="/logout"]' )
}; };
subtest Hidden => sub { subtest Hidden => sub {
@ -90,6 +91,7 @@ subtest Login => sub {
->text_like(h2 => qr/Hidden Posts/) ->text_like(h2 => qr/Hidden Posts/)
->element_exists('a[href*="/moderator/flagged"]') ->element_exists('a[href*="/moderator/flagged"]')
->element_exists('a[href*="/moderator/hidden"]' ) ->element_exists('a[href*="/moderator/hidden"]' )
->element_exists('a[href*="/logout"]' )
}; };
# Mod session ends # Mod session ends
@ -101,14 +103,20 @@ subtest Login => sub {
$t->get_ok('/thread/single/1') $t->get_ok('/thread/single/1')
->status_is(200) ->status_is(200)
->element_exists_not('a[href*="/hide/1"]' ) ->element_exists_not('a[href*="/hide/1"]' )
->element_exists_not('a[href*="/unhide/1"]') ->element_exists_not('a[href*="/unhide/1"]' )
->element_exists_not('a[href*="/unflag/1"]'); ->element_exists_not('a[href*="/unflag/1"]' )
->element_exists_not('a[href*="/moderator/flagged"]')
->element_exists_not('a[href*="/moderator/hidden"]' )
->element_exists_not('a[href*="/logout"]' );
$t->get_ok('/remark/single/1') $t->get_ok('/remark/single/1')
->status_is(200) ->status_is(200)
->element_exists_not('a[href*="/hide/1"]' ) ->element_exists_not('a[href*="/hide/1"]' )
->element_exists_not('a[href*="/unhide/1"]') ->element_exists_not('a[href*="/unhide/1"]' )
->element_exists_not('a[href*="/unflag/1"]'); ->element_exists_not('a[href*="/unflag/1"]' )
->element_exists_not('a[href*="/moderator/flagged"]')
->element_exists_not('a[href*="/moderator/hidden"]' )
->element_exists_not('a[href*="/logout"]' );
$t->get_ok('/moderator/flagged') $t->get_ok('/moderator/flagged')
->status_is(302) ->status_is(302)