@@ -1633,37 +1633,60 @@ def set_from_list_of_dict(data):
1633
1633
update_left_panel .assert_called_once_with ()
1634
1634
model .controller .update_screen .assert_called_once_with ()
1635
1635
1636
- @pytest .mark .parametrize ('event, expected_subscribers' , [
1636
+ @pytest .mark .parametrize (['event' , 'feature_level' ,
1637
+ 'stream_id' , 'expected_subscribers' ], [
1637
1638
({'type' : 'subscription' , 'op' : 'peer_add' ,
1638
- 'stream_id' : 99 , 'user_id' : 12 }, [1001 , 11 , 12 ]),
1639
+ 'stream_id' : 99 , 'user_id' : 12 }, None , 99 , [1001 , 11 , 12 ]),
1640
+ ({'type' : 'subscription' , 'op' : 'peer_add' ,
1641
+ 'stream_id' : 99 , 'user_id' : 12 }, 34 , 99 , [1001 , 11 , 12 ]),
1642
+ ({'type' : 'subscription' , 'op' : 'peer_add' ,
1643
+ 'stream_ids' : [99 ], 'user_ids' : [12 ]}, 35 , 99 , [1001 , 11 , 12 ]),
1644
+ ({'type' : 'subscription' , 'op' : 'peer_remove' ,
1645
+ 'stream_id' : 2 , 'user_id' : 12 }, None , 2 , [1001 , 11 ]),
1639
1646
({'type' : 'subscription' , 'op' : 'peer_remove' ,
1640
- 'stream_id' : 2 , 'user_id' : 12 }, [1001 , 11 ]),
1647
+ 'stream_id' : 2 , 'user_id' : 12 }, 34 , 2 , [1001 , 11 ]),
1648
+ ({'type' : 'subscription' , 'op' : 'peer_remove' ,
1649
+ 'stream_ids' : [2 ], 'user_ids' : [12 ]}, 35 , 2 , [1001 , 11 ]),
1641
1650
], ids = [
1642
- 'user_subscribed_to_stream' ,
1643
- 'user_unsubscribed_from_stream' ,
1651
+ 'user_subscribed_to_stream:ZFLNone' ,
1652
+ 'user_subscribed_to_stream:ZFL34' ,
1653
+ 'user_subscribed_to_stream:ZFL35' ,
1654
+ 'user_unsubscribed_from_stream:ZFLNone' ,
1655
+ 'user_unsubscribed_from_stream:ZFL34' ,
1656
+ 'user_unsubscribed_from_stream:ZFL35' ,
1644
1657
])
1645
1658
def test__handle_subscription_event_subscribers (self , model , mocker ,
1646
- stream_dict , event ,
1659
+ stream_dict ,
1660
+ event , feature_level ,
1661
+ stream_id ,
1647
1662
expected_subscribers ):
1648
1663
model .stream_dict = stream_dict
1664
+ model .server_feature_level = feature_level
1649
1665
1650
1666
model ._handle_subscription_event (event )
1651
1667
1652
- new_subscribers = model .stream_dict [event [ ' stream_id' ] ]['subscribers' ]
1668
+ new_subscribers = model .stream_dict [stream_id ]['subscribers' ]
1653
1669
assert new_subscribers == expected_subscribers
1654
1670
1655
- @pytest .mark .parametrize ('event' , [
1671
+ @pytest .mark .parametrize ('event, feature_level' , [
1672
+ ({'type' : 'subscription' , 'op' : 'peer_add' ,
1673
+ 'stream_id' : 462 , 'user_id' : 12 }, 34 ),
1656
1674
({'type' : 'subscription' , 'op' : 'peer_add' ,
1657
- 'stream_id' : 462 , 'user_id' : 12 }),
1675
+ 'stream_ids' : [462 ], 'user_ids' : [12 ]}, 35 ),
1676
+ ({'type' : 'subscription' , 'op' : 'peer_remove' ,
1677
+ 'stream_id' : 462 , 'user_id' : 12 }, 34 ),
1658
1678
({'type' : 'subscription' , 'op' : 'peer_remove' ,
1659
- 'stream_id ' : 462 , 'user_id ' : 12 } ),
1679
+ 'stream_ids ' : [ 462 ] , 'user_ids ' : [ 12 ]}, 35 ),
1660
1680
], ids = [
1661
1681
'peer_subscribed_to_stream_that_user_is_unsubscribed_to' ,
1682
+ 'peer_subscribed_to_stream_that_user_is_unsubscribed_to:ZFL35+' ,
1662
1683
'peer_unsubscribed_from_stream_that_user_is_unsubscribed_to' ,
1684
+ 'peer_unsubscribed_from_stream_that_user_is_unsubscribed_to:ZFL35+' ,
1663
1685
])
1664
1686
def test__handle_subscription_event_subscribers_to_unsubscribed_streams (
1665
- self , model , mocker , stream_dict , event ):
1687
+ self , model , mocker , stream_dict , event , feature_level ):
1666
1688
model .stream_dict = deepcopy (stream_dict )
1689
+ model .server_feature_level = feature_level
1667
1690
1668
1691
model ._handle_subscription_event (event )
1669
1692
0 commit comments