Esempio n. 1
0
    def test_update_count(
        self,
        mocker: MockerFixture,
        top_button: TopButton,
        old_count: int,
        new_count: int,
        new_count_str: str,
        text_color: Optional[str],
    ) -> None:
        top_button.count = old_count
        top_button_update_widget = mocker.patch(MODULE +
                                                ".TopButton.update_widget")

        top_button.update_count(new_count, text_color)

        top_button_update_widget.assert_called_once_with(
            (top_button.count_style, new_count_str),
            text_color,
        )
Esempio n. 2
0
    def test_update_count(self,
                          mocker,
                          old_count,
                          new_count,
                          new_count_str,
                          width=12):
        top_button = TopButton(
            controller=mocker.Mock(),
            caption="caption",
            show_function=mocker.Mock(),
            width=width,
            count=old_count,
            count_style="starred_count",
        )
        # Avoid testing use in initialization by patching afterwards
        update_widget = mocker.patch(TOPBUTTON + ".update_widget")

        top_button.update_count(new_count)

        update_widget.assert_called_once_with(
            (top_button.count_style, new_count_str),
            None,
        )