def test_activate_called_once_on_keypress( self, mocker, enter_key, widget_size, caption="some user", email="some_email", user_id=5, ): user: Dict[str, Any] = { "email": email, "user_id": user_id, "full_name": caption, } activate = mocker.patch(MODULE + ".UserButton.activate") user_button = UserButton( user, controller=mocker.Mock(), view=mocker.Mock(), color=mocker.Mock(), state_marker="*", count=mocker.Mock(), ) size = widget_size(user_button) user_button.keypress(size, enter_key) assert activate.call_count == 1
def test_activate_called_once_on_keypress( self, mocker, enter_key, widget_size, caption="some user", width=30, email='some_email', user_id=5, ): user: Dict[str, Any] = { 'email': email, 'user_id': user_id, 'full_name': caption, } activate = mocker.patch(BUTTONS + ".UserButton.activate") user_button = UserButton(user, controller=mocker.Mock(), view=mocker.Mock(), width=width, color=mocker.Mock(), state_marker="*", count=mocker.Mock()) size = widget_size(user_button) user_button.keypress(size, enter_key) assert activate.call_count == 1
def test_activate_called_once_on_keypress( self, mocker: MockerFixture, enter_key: str, widget_size: Callable[[Widget], urwid_Size], caption: str = "some user", email: str = "some_email", user_id: int = 5, ) -> None: user: Dict[str, Any] = { "email": email, "user_id": user_id, "full_name": caption, } activate = mocker.patch(MODULE + ".UserButton.activate") user_button = UserButton( user=user, controller=mocker.Mock(), view=mocker.Mock(), color=mocker.Mock(), state_marker="*", count=mocker.Mock(), ) size = widget_size(user_button) user_button.keypress(size, enter_key) assert activate.call_count == 1
def test_keypress_USER_INFO( self, mocker: MockerFixture, user_button: UserButton, key: str, widget_size: Callable[[Widget], urwid_Size], ) -> None: size = widget_size(user_button) pop_up = mocker.patch("zulipterminal.core.Controller.show_user_info") user_button.keypress(size, key) pop_up.assert_called_once_with(user_button.user_id)