t/22-visibility: also check ajax status and profile

This commit is contained in:
Derf Null 2023-06-26 20:49:58 +02:00
parent 16237bfe21
commit f0be693811
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA

View file

@ -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();