summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/21-relations.t470
1 files changed, 400 insertions, 70 deletions
diff --git a/t/21-relations.t b/t/21-relations.t
index 5b68555..0a33dc5 100644
--- a/t/21-relations.t
+++ b/t/21-relations.t
@@ -90,12 +90,40 @@ is( scalar $u->get_followees( uid => $uid1 ), 0 );
is( scalar $u->get_followees( uid => $uid2 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid1 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid2 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
-is( $u->has_follow_requests( uid => $uid1 ), 0 );
-is( $u->has_follow_requests( uid => $uid2 ), 0 );
-is( $u->get( uid => $uid1 )->{notifications}, 0 );
-is( $u->get( uid => $uid2 )->{notifications}, 0 );
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
+is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
+is( $u->has_follow_requests( uid => $uid1 ), 0 );
+is( $u->has_follow_requests( uid => $uid2 ), 0 );
+is(
+ $u->has_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ $u->has_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( $u->get( uid => $uid1 )->{notifications}, 0 );
+is( $u->get( uid => $uid2 )->{notifications}, 0 );
$u->request_follow(
uid => $uid1,
@@ -122,16 +150,48 @@ is( scalar $u->get_followees( uid => $uid1 ), 0 );
is( scalar $u->get_followees( uid => $uid2 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid1 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid2 ), 1 );
-is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
-is( $u->has_follow_requests( uid => $uid1 ), 0 );
-is( $u->has_follow_requests( uid => $uid2 ), 1 );
-is( $u->get( uid => $uid1 )->{notifications}, 0 );
-is( $u->get( uid => $uid2 )->{notifications}, 1 );
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 1
+);
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
+is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
+is( $u->has_follow_requests( uid => $uid1 ), 0 );
+is( $u->has_follow_requests( uid => $uid2 ), 1 );
+is(
+ $u->has_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 1
+);
+is(
+ $u->has_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( $u->get( uid => $uid1 )->{notifications}, 0 );
+is( $u->get( uid => $uid2 )->{notifications}, 1 );
is_deeply(
[ $u->get_follow_requests( uid => $uid2 ) ],
[ { id => $uid1, name => 'test1' } ]
);
+is_deeply(
+ [ $u->get_follow_requests( uid => $uid1, sent => 1 ) ],
+ [ { id => $uid2, name => 'test2' } ]
+);
$u->reject_follow_request(
uid => $uid2,
@@ -158,10 +218,24 @@ is( scalar $u->get_followees( uid => $uid1 ), 0 );
is( scalar $u->get_followees( uid => $uid2 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid1 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid2 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
-is( $u->get( uid => $uid1 )->{notifications}, 0 );
-is( $u->get( uid => $uid2 )->{notifications}, 0 );
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
+is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
+is( $u->get( uid => $uid1 )->{notifications}, 0 );
+is( $u->get( uid => $uid2 )->{notifications}, 0 );
$u->request_follow(
uid => $uid1,
@@ -188,16 +262,48 @@ is( scalar $u->get_followees( uid => $uid1 ), 0 );
is( scalar $u->get_followees( uid => $uid2 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid1 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid2 ), 1 );
-is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
-is( $u->has_follow_requests( uid => $uid1 ), 0 );
-is( $u->has_follow_requests( uid => $uid2 ), 1 );
-is( $u->get( uid => $uid1 )->{notifications}, 0 );
-is( $u->get( uid => $uid2 )->{notifications}, 1 );
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 1
+);
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
+is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
+is( $u->has_follow_requests( uid => $uid1 ), 0 );
+is( $u->has_follow_requests( uid => $uid2 ), 1 );
+is(
+ $u->has_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 1
+);
+is(
+ $u->has_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( $u->get( uid => $uid1 )->{notifications}, 0 );
+is( $u->get( uid => $uid2 )->{notifications}, 1 );
is_deeply(
[ $u->get_follow_requests( uid => $uid2 ) ],
[ { id => $uid1, name => 'test1' } ]
);
+is_deeply(
+ [ $u->get_follow_requests( uid => $uid1, sent => 1 ) ],
+ [ { id => $uid2, name => 'test2' } ]
+);
$u->accept_follow_request(
uid => $uid2,
@@ -224,12 +330,40 @@ is( scalar $u->get_followees( uid => $uid1 ), 1 );
is( scalar $u->get_followees( uid => $uid2 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid1 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid2 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
-is( $u->has_follow_requests( uid => $uid1 ), 0 );
-is( $u->has_follow_requests( uid => $uid2 ), 0 );
-is( $u->get( uid => $uid1 )->{notifications}, 0 );
-is( $u->get( uid => $uid2 )->{notifications}, 0 );
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
+is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
+is( $u->has_follow_requests( uid => $uid1 ), 0 );
+is( $u->has_follow_requests( uid => $uid2 ), 0 );
+is(
+ $u->has_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ $u->has_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( $u->get( uid => $uid1 )->{notifications}, 0 );
+is( $u->get( uid => $uid2 )->{notifications}, 0 );
is_deeply(
[ $u->get_followers( uid => $uid2 ) ],
[
@@ -273,12 +407,40 @@ is( scalar $u->get_followees( uid => $uid1 ), 0 );
is( scalar $u->get_followees( uid => $uid2 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid1 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid2 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
-is( $u->has_follow_requests( uid => $uid1 ), 0 );
-is( $u->has_follow_requests( uid => $uid2 ), 0 );
-is( $u->get( uid => $uid1 )->{notifications}, 0 );
-is( $u->get( uid => $uid2 )->{notifications}, 0 );
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
+is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
+is( $u->has_follow_requests( uid => $uid1 ), 0 );
+is( $u->has_follow_requests( uid => $uid2 ), 0 );
+is(
+ $u->has_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ $u->has_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( $u->get( uid => $uid1 )->{notifications}, 0 );
+is( $u->get( uid => $uid2 )->{notifications}, 0 );
$u->request_follow(
uid => $uid1,
@@ -325,12 +487,40 @@ is( scalar $u->get_followees( uid => $uid1 ), 0 );
is( scalar $u->get_followees( uid => $uid2 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid1 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid2 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid2 ), 1 );
-is( $u->has_follow_requests( uid => $uid1 ), 0 );
-is( $u->has_follow_requests( uid => $uid2 ), 0 );
-is( $u->get( uid => $uid1 )->{notifications}, 0 );
-is( $u->get( uid => $uid2 )->{notifications}, 0 );
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
+is( scalar $u->get_blocked_users( uid => $uid2 ), 1 );
+is( $u->has_follow_requests( uid => $uid1 ), 0 );
+is( $u->has_follow_requests( uid => $uid2 ), 0 );
+is(
+ $u->has_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ $u->has_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( $u->get( uid => $uid1 )->{notifications}, 0 );
+is( $u->get( uid => $uid2 )->{notifications}, 0 );
is_deeply(
[ $u->get_blocked_users( uid => $uid2 ) ],
[ { id => $uid1, name => 'test1' } ]
@@ -361,12 +551,40 @@ is( scalar $u->get_followees( uid => $uid1 ), 0 );
is( scalar $u->get_followees( uid => $uid2 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid1 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid2 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
-is( $u->has_follow_requests( uid => $uid1 ), 0 );
-is( $u->has_follow_requests( uid => $uid2 ), 0 );
-is( $u->get( uid => $uid1 )->{notifications}, 0 );
-is( $u->get( uid => $uid2 )->{notifications}, 0 );
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
+is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
+is( $u->has_follow_requests( uid => $uid1 ), 0 );
+is( $u->has_follow_requests( uid => $uid2 ), 0 );
+is(
+ $u->has_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ $u->has_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( $u->get( uid => $uid1 )->{notifications}, 0 );
+is( $u->get( uid => $uid2 )->{notifications}, 0 );
$u->block(
uid => $uid2,
@@ -393,12 +611,40 @@ is( scalar $u->get_followees( uid => $uid1 ), 0 );
is( scalar $u->get_followees( uid => $uid2 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid1 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid2 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid2 ), 1 );
-is( $u->has_follow_requests( uid => $uid1 ), 0 );
-is( $u->has_follow_requests( uid => $uid2 ), 0 );
-is( $u->get( uid => $uid1 )->{notifications}, 0 );
-is( $u->get( uid => $uid2 )->{notifications}, 0 );
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
+is( scalar $u->get_blocked_users( uid => $uid2 ), 1 );
+is( $u->has_follow_requests( uid => $uid1 ), 0 );
+is( $u->has_follow_requests( uid => $uid2 ), 0 );
+is(
+ $u->has_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ $u->has_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( $u->get( uid => $uid1 )->{notifications}, 0 );
+is( $u->get( uid => $uid2 )->{notifications}, 0 );
is_deeply(
[ $u->get_blocked_users( uid => $uid2 ) ],
[ { id => $uid1, name => 'test1' } ]
@@ -429,12 +675,40 @@ is( scalar $u->get_followees( uid => $uid1 ), 0 );
is( scalar $u->get_followees( uid => $uid2 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid1 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid2 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
-is( $u->has_follow_requests( uid => $uid1 ), 0 );
-is( $u->has_follow_requests( uid => $uid2 ), 0 );
-is( $u->get( uid => $uid1 )->{notifications}, 0 );
-is( $u->get( uid => $uid2 )->{notifications}, 0 );
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
+is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
+is( $u->has_follow_requests( uid => $uid1 ), 0 );
+is( $u->has_follow_requests( uid => $uid2 ), 0 );
+is(
+ $u->has_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ $u->has_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( $u->get( uid => $uid1 )->{notifications}, 0 );
+is( $u->get( uid => $uid2 )->{notifications}, 0 );
$u->request_follow(
uid => $uid1,
@@ -465,12 +739,40 @@ is( scalar $u->get_followees( uid => $uid1 ), 1 );
is( scalar $u->get_followees( uid => $uid2 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid1 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid2 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
-is( $u->has_follow_requests( uid => $uid1 ), 0 );
-is( $u->has_follow_requests( uid => $uid2 ), 0 );
-is( $u->get( uid => $uid1 )->{notifications}, 0 );
-is( $u->get( uid => $uid2 )->{notifications}, 0 );
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
+is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
+is( $u->has_follow_requests( uid => $uid1 ), 0 );
+is( $u->has_follow_requests( uid => $uid2 ), 0 );
+is(
+ $u->has_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ $u->has_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( $u->get( uid => $uid1 )->{notifications}, 0 );
+is( $u->get( uid => $uid2 )->{notifications}, 0 );
is_deeply(
[ $u->get_followers( uid => $uid2 ) ],
[
@@ -514,12 +816,40 @@ is( scalar $u->get_followees( uid => $uid1 ), 0 );
is( scalar $u->get_followees( uid => $uid2 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid1 ), 0 );
is( scalar $u->get_follow_requests( uid => $uid2 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
-is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
-is( $u->has_follow_requests( uid => $uid1 ), 0 );
-is( $u->has_follow_requests( uid => $uid2 ), 0 );
-is( $u->get( uid => $uid1 )->{notifications}, 0 );
-is( $u->get( uid => $uid2 )->{notifications}, 0 );
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ scalar $u->get_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( scalar $u->get_blocked_users( uid => $uid1 ), 0 );
+is( scalar $u->get_blocked_users( uid => $uid2 ), 0 );
+is( $u->has_follow_requests( uid => $uid1 ), 0 );
+is( $u->has_follow_requests( uid => $uid2 ), 0 );
+is(
+ $u->has_follow_requests(
+ uid => $uid1,
+ sent => 1
+ ),
+ 0
+);
+is(
+ $u->has_follow_requests(
+ uid => $uid2,
+ sent => 1
+ ),
+ 0
+);
+is( $u->get( uid => $uid1 )->{notifications}, 0 );
+is( $u->get( uid => $uid2 )->{notifications}, 0 );
$t->app->pg->db->query('drop schema travelynx_test_21 cascade');
done_testing();