@@ -1920,12 +1920,12 @@ def test_subscribe_other_user_never_subscribed(self) -> None:
1920
1920
check_subscription_peer_add ("events[1]" , events [1 ])
1921
1921
1922
1922
def test_remove_other_user_never_subscribed (self ) -> None :
1923
- self .subscribe (self .example_user ("othello" ), "test_stream" )
1923
+ othello = self .example_user ("othello" )
1924
+ realm = othello .realm
1925
+ self .subscribe (othello , "test_stream" )
1924
1926
stream = get_stream ("test_stream" , self .user_profile .realm )
1925
1927
1926
- action = lambda : bulk_remove_subscriptions (
1927
- [self .example_user ("othello" )], [stream ], acting_user = None
1928
- )
1928
+ action = lambda : bulk_remove_subscriptions (realm , [othello ], [stream ], acting_user = None )
1929
1929
events = self .verify_action (action )
1930
1930
check_subscription_peer_remove ("events[0]" , events [0 ])
1931
1931
@@ -2476,13 +2476,15 @@ def do_test_subscribe_events(self, include_subscribers: bool) -> None:
2476
2476
)
2477
2477
check_subscription_peer_add ("events[0]" , events [0 ])
2478
2478
2479
+ hamlet = self .example_user ("hamlet" )
2480
+ iago = self .example_user ("iago" )
2481
+ othello = self .example_user ("othello" )
2482
+ realm = othello .realm
2479
2483
stream = get_stream ("test_stream" , self .user_profile .realm )
2480
2484
2481
2485
# Now remove the first user, to test the normal unsubscribe flow and
2482
2486
# 'peer_remove' event for subscribed streams.
2483
- action = lambda : bulk_remove_subscriptions (
2484
- [self .example_user ("othello" )], [stream ], acting_user = None
2485
- )
2487
+ action = lambda : bulk_remove_subscriptions (realm , [othello ], [stream ], acting_user = None )
2486
2488
events = self .verify_action (
2487
2489
action ,
2488
2490
include_subscribers = include_subscribers ,
@@ -2491,9 +2493,7 @@ def do_test_subscribe_events(self, include_subscribers: bool) -> None:
2491
2493
check_subscription_peer_remove ("events[0]" , events [0 ])
2492
2494
2493
2495
# Now remove the user himself, to test the 'remove' event flow
2494
- action = lambda : bulk_remove_subscriptions (
2495
- [self .example_user ("hamlet" )], [stream ], acting_user = None
2496
- )
2496
+ action = lambda : bulk_remove_subscriptions (realm , [hamlet ], [stream ], acting_user = None )
2497
2497
events = self .verify_action (
2498
2498
action , include_subscribers = include_subscribers , include_streams = False , num_events = 2
2499
2499
)
@@ -2515,9 +2515,7 @@ def do_test_subscribe_events(self, include_subscribers: bool) -> None:
2515
2515
check_subscription_peer_add ("events[0]" , events [0 ])
2516
2516
2517
2517
# Remove the user to test 'peer_remove' event flow for unsubscribed stream.
2518
- action = lambda : bulk_remove_subscriptions (
2519
- [self .example_user ("iago" )], [stream ], acting_user = None
2520
- )
2518
+ action = lambda : bulk_remove_subscriptions (realm , [iago ], [stream ], acting_user = None )
2521
2519
events = self .verify_action (
2522
2520
action ,
2523
2521
include_subscribers = include_subscribers ,
0 commit comments