Fix logging out and tests

This commit is contained in:
swag 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) {
delete $self->session->{'mod_id'};
delete $self->session->%{qw(mod_id is_admin)};
$self->flash(info => 'Logged out successfully 👋');

View File

@ -82,6 +82,7 @@ subtest Login => sub {
->text_like(h2 => qr/Flagged Posts/)
->element_exists('a[href*="/moderator/flagged"]')
->element_exists('a[href*="/moderator/hidden"]' )
->element_exists('a[href*="/logout"]' )
};
subtest Hidden => sub {
@ -90,6 +91,7 @@ subtest Login => sub {
->text_like(h2 => qr/Hidden Posts/)
->element_exists('a[href*="/moderator/flagged"]')
->element_exists('a[href*="/moderator/hidden"]' )
->element_exists('a[href*="/logout"]' )
};
# Mod session ends
@ -100,15 +102,21 @@ subtest Login => sub {
subtest 'No mod, no buttons', sub {
$t->get_ok('/thread/single/1')
->status_is(200)
->element_exists_not('a[href*="/hide/1"]' )
->element_exists_not('a[href*="/unhide/1"]')
->element_exists_not('a[href*="/unflag/1"]');
->element_exists_not('a[href*="/hide/1"]' )
->element_exists_not('a[href*="/unhide/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')
->status_is(200)
->element_exists_not('a[href*="/hide/1"]' )
->element_exists_not('a[href*="/unhide/1"]')
->element_exists_not('a[href*="/unflag/1"]');
->element_exists_not('a[href*="/hide/1"]' )
->element_exists_not('a[href*="/unhide/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')
->status_is(302)