From f0be693811bdba2f7a1328944c7820353f392cff Mon Sep 17 00:00:00 2001 From: Derf Null Date: Mon, 26 Jun 2023 20:49:58 +0200 Subject: [PATCH] t/22-visibility: also check ajax status and profile --- t/22-visibility.t | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/t/22-visibility.t b/t/22-visibility.t index 423f2b1..463d221 100644 --- a/t/22-visibility.t +++ b/t/22-visibility.t @@ -93,6 +93,10 @@ sub test_visibility { . q{?token=} . $status->{dep_eva} . q{-} . $status->{timestamp}->epoch % 337; + my $j_token + = $status->{dep_eva} . q{-} + . $status->{timestamp}->epoch % 337 . q{-} + . $status->{sched_departure}->epoch; is( $status->{visibility}, $opt{visibility} ); is( $status->{visibility_str}, $opt{visibility_str} ); @@ -101,19 +105,30 @@ sub test_visibility { if ( $opt{public} ) { $t->get_ok('/status/test1')->status_is(200)->content_like(qr{DPN 667}); + $t->get_ok('/ajax/status/test1.html')->status_is(200) + ->content_like(qr{DPN 667}); + $t->get_ok('/p/test1')->status_is(200)->content_like(qr{DPN 667}); } else { $t->get_ok('/status/test1')->status_is(200) ->content_like(qr{nicht eingecheckt}); + $t->get_ok('/ajax/status/test1.html')->status_is(200) + ->content_like(qr{nicht eingecheckt}); + $t->get_ok('/p/test1')->status_is(200) + ->content_like(qr{nicht eingecheckt}); } if ( $opt{with_token} ) { $t->get_ok("/status/test1/$token")->status_is(200) ->content_like(qr{DPN 667}); + $t->get_ok("/ajax/status/test1.html?token=$j_token")->status_is(200) + ->content_like(qr{DPN 667}); } else { $t->get_ok("/status/test1/$token")->status_is(200) ->content_like(qr{nicht eingecheckt}); + $t->get_ok("/ajax/status/test1.html?token=$j_token")->status_is(200) + ->content_like(qr{nicht eingecheckt}); } login( @@ -124,20 +139,31 @@ sub test_visibility { # users can see their own status if visibility is >= followrs if ( $opt{effective_visibility} >= 60 ) { $t->get_ok('/status/test1')->status_is(200)->content_like(qr{DPN 667}); + $t->get_ok('/ajax/status/test1.html')->status_is(200) + ->content_like(qr{DPN 667}); + $t->get_ok('/p/test1')->status_is(200)->content_like(qr{DPN 667}); } else { $t->get_ok('/status/test1')->status_is(200) ->content_like(qr{nicht eingecheckt}); + $t->get_ok('/ajax/status/test1.html')->status_is(200) + ->content_like(qr{nicht eingecheckt}); + $t->get_ok('/p/test1')->status_is(200) + ->content_like(qr{nicht eingecheckt}); } # users can see their own status with token if visibility is >= unlisted if ( $opt{effective_visibility} >= 30 ) { $t->get_ok("/status/test1/$token")->status_is(200) ->content_like(qr{DPN 667}); + $t->get_ok("/ajax/status/test1.html?token=$j_token")->status_is(200) + ->content_like(qr{DPN 667}); } else { $t->get_ok("/status/test1/$token")->status_is(200) ->content_like(qr{nicht eingecheckt}); + $t->get_ok("/ajax/status/test1.html?token=$j_token")->status_is(200) + ->content_like(qr{nicht eingecheckt}); } logout(); @@ -149,20 +175,31 @@ sub test_visibility { # uid2 can see uid1 if visibility is >= followers if ( $opt{effective_visibility} >= 60 ) { $t->get_ok('/status/test1')->status_is(200)->content_like(qr{DPN 667}); + $t->get_ok('/ajax/status/test1.html')->status_is(200) + ->content_like(qr{DPN 667}); + $t->get_ok('/p/test1')->status_is(200)->content_like(qr{DPN 667}); } else { $t->get_ok('/status/test1')->status_is(200) ->content_like(qr{nicht eingecheckt}); + $t->get_ok('/ajax/status/test1.html')->status_is(200) + ->content_like(qr{nicht eingecheckt}); + $t->get_ok('/p/test1')->status_is(200) + ->content_like(qr{nicht eingecheckt}); } # uid2 can see uid1 with token if visibility is >= unlisted if ( $opt{effective_visibility} >= 30 ) { $t->get_ok("/status/test1/$token")->status_is(200) ->content_like(qr{DPN 667}); + $t->get_ok("/ajax/status/test1.html?token=$j_token")->status_is(200) + ->content_like(qr{DPN 667}); } else { $t->get_ok("/status/test1/$token")->status_is(200) ->content_like(qr{nicht eingecheckt}); + $t->get_ok("/ajax/status/test1.html?token=$j_token")->status_is(200) + ->content_like(qr{nicht eingecheckt}); } logout(); @@ -174,20 +211,31 @@ sub test_visibility { # uid3 can see uid1 if visibility is >= travelynx if ( $opt{effective_visibility} >= 80 ) { $t->get_ok('/status/test1')->status_is(200)->content_like(qr{DPN 667}); + $t->get_ok('/ajax/status/test1.html')->status_is(200) + ->content_like(qr{DPN 667}); + $t->get_ok('/p/test1')->status_is(200)->content_like(qr{DPN 667}); } else { $t->get_ok('/status/test1')->status_is(200) ->content_like(qr{nicht eingecheckt}); + $t->get_ok('/ajax/status/test1.html')->status_is(200) + ->content_like(qr{nicht eingecheckt}); + $t->get_ok('/p/test1')->status_is(200) + ->content_like(qr{nicht eingecheckt}); } # uid3 can see uid1 with token if visibility is >= unlisted if ( $opt{effective_visibility} >= 30 ) { $t->get_ok("/status/test1/$token")->status_is(200) ->content_like(qr{DPN 667}); + $t->get_ok("/ajax/status/test1.html?token=$j_token")->status_is(200) + ->content_like(qr{DPN 667}); } else { $t->get_ok("/status/test1/$token")->status_is(200) ->content_like(qr{nicht eingecheckt}); + $t->get_ok("/ajax/status/test1.html?token=$j_token")->status_is(200) + ->content_like(qr{nicht eingecheckt}); } logout();