@@ -477,14 +477,10 @@ def test_keypress_navigation(self, mocker, stream_view,
477
477
stream_view .keypress (size , key )
478
478
super_view .assert_called_once_with (size , expected_key )
479
479
480
- @pytest .mark .parametrize ('button, key' , [
481
- (4 , 'up' ),
482
- (5 , 'down' ),
483
- ],
484
- ids = ['scroll_wheel_up' , 'scroll_wheel_down' ]
485
- )
486
- def test_mouse_event (self , mocker , stream_view , button , key ,
487
- size = (200 , 20 )):
480
+ def test_mouse_event (self , mocker , stream_view ,
481
+ mouse_press_key_button_pair , size = (200 , 20 )):
482
+ key , button = mouse_press_key_button_pair
483
+ mocker .patch (VIEWS + '.keys_for_command' , return_value = [key ])
488
484
mocker .patch .object (stream_view , 'keypress' )
489
485
stream_view .mouse_event (size , 'mouse press' , button , 1 , 1 , 'WIDGET' )
490
486
stream_view .keypress .assert_called_once_with (size , key )
@@ -671,6 +667,14 @@ def test_keypress_navigation(self, mocker, topic_view,
671
667
topic_view .keypress (size , key )
672
668
super_view .assert_called_once_with (size , expected_key )
673
669
670
+ def test_mouse_event (self , mocker , topic_view , mouse_press_key_button_pair ,
671
+ size = (200 , 20 )):
672
+ key , button = mouse_press_key_button_pair
673
+ mocker .patch (VIEWS + '.keys_for_command' , return_value = [key ])
674
+ mocker .patch .object (topic_view , 'keypress' )
675
+ topic_view .mouse_event (size , 'mouse press' , button , 1 , 1 , 'WIDGET' )
676
+ topic_view .keypress .assert_called_with (size , key )
677
+
674
678
675
679
class TestUsersView :
676
680
@@ -687,14 +691,10 @@ def test_keypress_navigation(self, mocker, user_view,
687
691
user_view .keypress (size , key )
688
692
super_view .assert_called_once_with (size , expected_key )
689
693
690
- @pytest .mark .parametrize ('button, key' , [
691
- (4 , 'up' ),
692
- (5 , 'down' ),
693
- ],
694
- ids = ['scroll_wheel_up' , 'scroll_wheel_down' ]
695
- )
696
- def test_mouse_event (self , mocker , user_view , button , key ,
694
+ def test_mouse_event (self , mocker , user_view , mouse_press_key_button_pair ,
697
695
size = (200 , 20 )):
696
+ key , button = mouse_press_key_button_pair
697
+ mocker .patch (VIEWS + '.keys_for_command' , return_value = [key ] * 5 )
698
698
mocker .patch .object (user_view , 'keypress' )
699
699
user_view .mouse_event (size , 'mouse press' , button , 1 , 1 , 'WIDGET' )
700
700
user_view .keypress .assert_called_with (size , key )
0 commit comments