コード例 #1
0
    def test_reset_group_and_pairs_to_default_correctly_identifies_maximum_number_of_periods_for_multiple_runs(self):
        self.context.current_runs = [62260, 62261, 62263]
        model = GroupingTabModel(self.context)

        status = model.reset_groups_and_pairs_to_default()
        self.assertEquals(status, "success")

        self.context.group_pair_context.reset_group_and_pairs_to_default.assert_called_once_with(mock.ANY, mock.ANY, mock.ANY, 4)
コード例 #2
0
    def setUp(self):
        # Store an empty widget to parent all the views, and ensure they are deleted correctly
        self.obj = QWidget()

        setup_context_for_tests(self)

        self.gui_variable_observer = Observer()

        self.gui_context.gui_variables_notifier.add_subscriber(self.gui_variable_observer)
        self.model = GroupingTabModel(context=self.context)
        self.presenter = DifferencePresenter(self.model)

        # Mock user input for getting diff name
        self.presenter.group_view.enter_diff_name = mock.Mock(side_effect=enter_diff_name_side_effect())
        self.presenter.pair_view.enter_diff_name = mock.Mock(side_effect=enter_diff_name_side_effect())

        # Mock warning methods
        self.presenter.group_view.warning_popup = mock.Mock()
        self.presenter.pair_view.warning_popup = mock.Mock()
コード例 #3
0
    def setUp(self):
        # Store an empty widget to parent all the views, and ensure they are deleted correctly
        self.obj = QWidget()

        setup_context_for_tests(self)

        self.add_three_groups_to_model()

        self.model = GroupingTabModel(context=self.context)
        self.view = PairingTableView(parent=self.obj)
        self.presenter = PairingTablePresenter(self.view, self.model)

        self.view.warning_popup = mock.Mock()
        self.view.enter_pair_name = mock.Mock(side_effect=pair_name())
コード例 #4
0
    def setUp(self):
        # Store an empty widget to parent all the views, and ensure they are deleted correctly
        self.obj = QWidget()

        setup_context_for_tests(self)

        self.gui_variable_observer = Observer()

        self.gui_context.gui_variables_notifier.add_subscriber(self.gui_variable_observer)
        self.model = GroupingTabModel(context=self.context)
        self.view = GroupingTableView(parent=self.obj)
        self.presenter = GroupingTablePresenter(self.view, self.model)

        self.view.enter_group_name = mock.Mock(side_effect=group_name())
        self.view.warning_popup = mock.Mock()
        self.gui_variable_observer.update = mock.MagicMock()
コード例 #5
0
    def setUp(self):
        self.obj = QWidget()

        self.loaded_data = MuonLoadData()

        setup_context_for_tests(self)

        self.model = GroupingTabModel(context=self.context)

        self.grouping_table_view = GroupingTableView()
        self.grouping_table_widget = GroupingTablePresenter(
            self.grouping_table_view, self.model)

        self.pairing_table_view = PairingTableView()
        self.pairing_table_widget = PairingTablePresenter(
            self.pairing_table_view, self.model)

        self.diff_widget = DifferencePresenter(self.model)
        self.diff_widget.group_view.enter_diff_name = mock.Mock(
            side_effect=diff_name())
        self.diff_widget.pair_view.enter_diff_name = mock.Mock(
            side_effect=diff_name())

        self.grouping_table_view.warning_popup = mock.MagicMock()
        self.pairing_table_view.warning_popup = mock.MagicMock()

        self.add_three_groups()
        self.add_two_pairs()

        self.view = GroupingTabView(self.grouping_table_view,
                                    self.pairing_table_view,
                                    self.diff_widget.view)
        self.presenter = GroupingTabPresenter(self.view, self.model,
                                              self.grouping_table_widget,
                                              self.pairing_table_widget,
                                              self.diff_widget)

        self.presenter.create_update_thread = mock.MagicMock(
            return_value=mock.MagicMock())
        self.presenter.pairing_table_widget.handle_add_pair_button_clicked = mock.MagicMock(
        )
        self.view.display_warning_box = mock.MagicMock()
        self.grouping_table_view.warning_popup = mock.MagicMock()
        self.pairing_table_view.warning_popup = mock.MagicMock()
コード例 #6
0
    def __init__(self, context, parent=None):

        self.group_tab_model = GroupingTabModel(context)

        self.grouping_table_view = GroupingTableView()
        self.grouping_table_widget = GroupingTablePresenter(self.grouping_table_view, self.group_tab_model)

        self.diff_table = DifferencePresenter(self.group_tab_model)

        self.pairing_table_view = PairingTableView()
        self.pairing_table_widget = PairingTablePresenter(self.pairing_table_view, self.group_tab_model)

        self.group_tab_view = GroupingTabView(self.grouping_table_view, self.pairing_table_view, self.diff_table.view)
        self.group_tab_presenter = GroupingTabPresenter(self.group_tab_view,
                                                        self.group_tab_model,
                                                        self.grouping_table_widget,
                                                        self.pairing_table_widget, self.diff_table, parent)

        context.update_view_from_model_notifier.add_subscriber(self.group_tab_presenter.update_view_from_model_observer)
コード例 #7
0
    def test_reset_group_and_pairs_to_default_for_no_loaded_runs(self):
        self.context.current_runs = []
        model = GroupingTabModel(self.context)

        status = model.reset_groups_and_pairs_to_default()
        self.assertEquals(status, "failed")
コード例 #8
0
class DifferenceTablePresenterTest(unittest.TestCase):

    def setUp(self):
        # Store an empty widget to parent all the views, and ensure they are deleted correctly
        self.obj = QWidget()

        setup_context_for_tests(self)

        self.gui_variable_observer = Observer()

        self.gui_context.gui_variables_notifier.add_subscriber(self.gui_variable_observer)
        self.model = GroupingTabModel(context=self.context)
        self.presenter = DifferencePresenter(self.model)

        # Mock user input for getting diff name
        self.presenter.group_view.enter_diff_name = mock.Mock(side_effect=enter_diff_name_side_effect())
        self.presenter.pair_view.enter_diff_name = mock.Mock(side_effect=enter_diff_name_side_effect())

        # Mock warning methods
        self.presenter.group_view.warning_popup = mock.Mock()
        self.presenter.pair_view.warning_popup = mock.Mock()

    def tearDown(self):
        self.obj = None

    def assert_model_empty(self):
        self.assertEqual(0, len(self.model.diff_names))
        self.assertEqual(0, len(self.model.diffs))

    def assert_view_empty(self):
        self.assertEqual(0, self.presenter.group_view.num_rows())
        self.assertEqual(0, self.presenter.pair_view.num_rows())

    def add_two_groups(self):
        group0 = MuonGroup(group_name="group_0", detector_ids=[1])
        group1 = MuonGroup(group_name="group_1", detector_ids=[2])
        self.model.add_group(group0)
        self.model.add_group(group1)

    def add_two_pairs(self):
        pair0 = MuonPair(pair_name="pair_0", forward_group_name="group_0", backward_group_name="group_1", alpha=1.0)
        pair1 = MuonPair(pair_name="pair_1", forward_group_name="group_1", backward_group_name="group_0", alpha=1.0)
        self.model.add_pair(pair0)
        self.model.add_pair(pair1)

    def add_two_group_diffs(self):
        self.add_two_groups()
        diff0 = MuonDiff('group_diff_0', 'group_0', 'group_1')
        diff1 = MuonDiff('group_diff_1', 'group_1', 'group_0')
        self.presenter.group_widget.add_diff(diff0)
        self.presenter.group_widget.add_diff(diff1)

    def add_two_pair_diffs(self):
        self.add_two_groups()
        self.add_two_pairs()
        diff0 = MuonDiff('pair_diff_0', 'pair_0', 'pair_1', group_or_pair='pair')
        diff1 = MuonDiff('pair_diff_1', 'pair_1', 'pair_0', group_or_pair='pair')
        self.presenter.pair_widget.add_diff(diff0)
        self.presenter.pair_widget.add_diff(diff1)

    def get_group_1_selector_from_diff(self, row):
        return self.presenter.group_view.diff_table.cellWidget(row, 2)

    def get_group_2_selector_from_diff(self, row):
        return self.presenter.group_view.diff_table.cellWidget(row, 3)

    def get_pair_1_selector_from_diff(self, row):
        return self.presenter.pair_view.diff_table.cellWidget(row, 2)

    def get_pair_2_selector_from_diff(self, row):
        return self.presenter.pair_view.diff_table.cellWidget(row, 3)

    # ------------------------------------------------------------------------------------------------------------------
    # TESTS : test the functionality around the combo boxes which allow the user to select the two groups or two pairs
    #         that together make the muon difference.
    # ------------------------------------------------------------------------------------------------------------------

    def test_adding_groups_then_group_diff_sets_combo_boxes_to_added_groups(self):
        self.add_two_groups()
        self.presenter.group_widget.handle_add_diff_button_clicked()

        self.assertEqual('group_0', self.get_group_1_selector_from_diff(0).currentText())
        self.assertEqual('group_1', self.get_group_2_selector_from_diff(0).currentText())

    def test_adding_pairs_then_pair_diff_sets_combo_boxes_to_added_pairs(self):
        self.add_two_pairs()
        self.presenter.pair_widget.handle_add_diff_button_clicked()

        self.assertEqual('pair_0', self.get_pair_1_selector_from_diff(0).currentText())
        self.assertEqual('pair_1', self.get_pair_2_selector_from_diff(0).currentText())

    def test_get_index_of_text_returns_correct_index_if_text_exists(self):
        self.add_two_groups()
        self.presenter.group_widget.handle_add_diff_button_clicked()
        index = self.presenter.group_view.get_index_of_text(self.get_group_1_selector_from_diff(0), 'group_1')

        self.assertEqual(index, 1)

    def test_get_index_of_text_returns_0_if_text_does_not_exists(self):
        self.add_two_groups()
        self.presenter.group_widget.handle_add_diff_button_clicked()
        index = self.presenter.group_view.get_index_of_text(self.get_group_1_selector_from_diff(0), 'not_a_group_1')

        self.assertEqual(index, 0)

    def test_added_groups_appear_in_selector_combo_boxes_in_existing_diffs(self):
        self.add_two_groups()
        self.presenter.group_widget.handle_add_diff_button_clicked()
        self.presenter.update_view_from_model()

        self.assertEqual(2, self.get_group_1_selector_from_diff(0).count())
        self.assertNotEqual(-1, self.get_group_1_selector_from_diff(0).findText('group_0'))
        self.assertNotEqual(-1, self.get_group_1_selector_from_diff(0).findText('group_1'))

    def test_removing_groups_removes_them_from_selection(self):
        self.add_two_groups()
        # Add an extra group so we can remove one and keep a diff
        group = MuonGroup(group_name="group_2", detector_ids=[2])
        self.model.add_group(group)
        self.presenter.group_widget.handle_add_diff_button_clicked(group_1='group_0',group_2='group_2')

        self.group_context.remove_group('group_1')
        self.presenter.update_view_from_model()

        self.assertEqual(2, self.get_group_1_selector_from_diff(0).count())
        self.assertEqual(2, self.get_group_2_selector_from_diff(0).count())
        self.assertEqual(-1, self.get_group_2_selector_from_diff(0).findText('group_1'))
        self.assertEqual(-1, self.get_group_2_selector_from_diff(0).findText('group_1'))

    def test_changing_group_selection_triggers_cell_changed_method_in_view(self):
        self.add_two_groups()
        self.presenter.group_widget.handle_add_diff_button_clicked()
        self.presenter.group_widget.handle_add_diff_button_clicked()
        self.presenter.group_view.on_cell_changed = mock.Mock()
        self.get_group_1_selector_from_diff(0).setCurrentIndex(1)

        self.assertEqual(1, self.presenter.group_view.on_cell_changed.call_count)
        self.assertEqual((0,2), self.presenter.group_view.on_cell_changed.call_args_list[0][0])

    def test_adding_new_group_does_not_change_current_selection(self):
        self.add_two_groups()
        self.presenter.group_widget.handle_add_diff_button_clicked()

        self.assertEqual(2, self.get_group_1_selector_from_diff(0).count())
        self.assertEqual(2, self.get_group_2_selector_from_diff(0).count())
        self.assertEqual('group_0', self.get_group_1_selector_from_diff(0).currentText())
        self.assertEqual('group_1', self.get_group_2_selector_from_diff(0).currentText())

        group = MuonGroup(group_name="group_2", detector_ids=[2])
        self.model.add_group(group)
        self.presenter.update_view_from_model()

        self.assertEqual(3, self.get_group_1_selector_from_diff(0).count())
        self.assertEqual(3, self.get_group_2_selector_from_diff(0).count())
        self.assertEqual('group_0', self.get_group_1_selector_from_diff(0).currentText())
        self.assertEqual('group_1', self.get_group_2_selector_from_diff(0).currentText())

    def test_changing_group_to_other_group_switches_groups(self):
        self.add_two_groups()
        self.presenter.group_widget.handle_add_diff_button_clicked()

        self.assertEqual(2, self.get_group_1_selector_from_diff(0).count())
        self.assertEqual(2, self.get_group_1_selector_from_diff(0).count())
        self.assertEqual('group_0', self.get_group_1_selector_from_diff(0).currentText())
        self.assertEqual('group_1', self.get_group_2_selector_from_diff(0).currentText())

        self.get_group_1_selector_from_diff(0).setCurrentIndex(1)

        self.assertEqual(2, self.get_group_1_selector_from_diff(0).count())
        self.assertEqual(2, self.get_group_1_selector_from_diff(0).count())
        self.assertEqual('group_1', self.get_group_1_selector_from_diff(0).currentText())
        self.assertEqual('group_0', self.get_group_2_selector_from_diff(0).currentText())
コード例 #9
0
class DifferenceTablePresenterTest(unittest.TestCase):
    def setUp(self):
        # Store an empty widget to parent all the views, and ensure they are deleted correctly
        self.obj = QWidget()

        setup_context_for_tests(self)

        self.gui_variable_observer = Observer()

        self.gui_context.gui_variables_notifier.add_subscriber(
            self.gui_variable_observer)
        self.model = GroupingTabModel(context=self.context)
        self.presenter = DifferencePresenter(self.model)

        # Mock user input for getting diff name
        self.presenter.group_view.enter_diff_name = mock.Mock(
            side_effect=enter_diff_name_side_effect())
        self.presenter.pair_view.enter_diff_name = mock.Mock(
            side_effect=enter_diff_name_side_effect())

        # Mock warning methods
        self.presenter.group_view.warning_popup = mock.Mock()
        self.presenter.pair_view.warning_popup = mock.Mock()

    def tearDown(self):
        self.obj = None

    def assert_model_empty(self):
        self.assertEqual(0, len(self.model.diff_names))
        self.assertEqual(0, len(self.model.diffs))

    def assert_view_empty(self):
        self.assertEqual(0, self.presenter.group_view.num_rows())
        self.assertEqual(0, self.presenter.pair_view.num_rows())

    def add_two_groups(self):
        group0 = MuonGroup(group_name="group_0", detector_ids=[1])
        group1 = MuonGroup(group_name="group_1", detector_ids=[2])
        self.model.add_group(group0)
        self.model.add_group(group1)

    def add_two_pairs(self):
        pair0 = MuonPair(pair_name="pair_0",
                         forward_group_name="group_0",
                         backward_group_name="group_1",
                         alpha=1.0)
        pair1 = MuonPair(pair_name="pair_1",
                         forward_group_name="group_1",
                         backward_group_name="group_0",
                         alpha=1.0)
        self.model.add_pair(pair0)
        self.model.add_pair(pair1)

    def add_two_group_diffs(self):
        self.add_two_groups()
        diff0 = MuonDiff('group_diff_0', 'group_0', 'group_1')
        diff1 = MuonDiff('group_diff_1', 'group_1', 'group_0')
        self.presenter.group_widget.add_diff(diff0)
        self.presenter.group_widget.add_diff(diff1)

    def add_two_pair_diffs(self):
        self.add_two_groups()
        self.add_two_pairs()
        diff0 = MuonDiff('pair_diff_0',
                         'pair_0',
                         'pair_1',
                         group_or_pair='pair')
        diff1 = MuonDiff('pair_diff_1',
                         'pair_1',
                         'pair_0',
                         group_or_pair='pair')
        self.presenter.pair_widget.add_diff(diff0)
        self.presenter.pair_widget.add_diff(diff1)

    # ------------------------------------------------------------------------------------------------------------------
    # TESTS : Initialization
    # ------------------------------------------------------------------------------------------------------------------

    def test_that_table_has_four_columns_when_initialized(self):
        self.assertEqual(4, self.presenter.group_view.num_cols())
        self.assertEqual(4, self.presenter.pair_view.num_cols())

    def test_that_model_is_initialized_as_empty(self):
        self.assert_model_empty()

    def test_that_view_is_initialized_as_empty(self):
        self.assert_view_empty()

    def test_header_labels_set_correctly(self):
        self.assertEqual(
            'Group 1',
            self.presenter.group_view.diff_table.horizontalHeaderItem(
                2).text())
        self.assertEqual(
            'Group 2',
            self.presenter.group_view.diff_table.horizontalHeaderItem(
                3).text())
        self.assertEqual(
            'Pair 1',
            self.presenter.pair_view.diff_table.horizontalHeaderItem(2).text())
        self.assertEqual(
            'Pair 2',
            self.presenter.pair_view.diff_table.horizontalHeaderItem(3).text())

    # ------------------------------------------------------------------------------------------------------------------
    # TESTS : Adding and removing diffs
    # ------------------------------------------------------------------------------------------------------------------

    def test_add_two_group_diffs_function(self):
        self.add_two_group_diffs()

        self.assertEqual(2, self.presenter.group_view.num_rows())
        self.assertEqual("group_diff_0",
                         self.presenter.group_view.get_table_item_text(0, 0))
        self.assertEqual("group_diff_1",
                         self.presenter.group_view.get_table_item_text(1, 0))

    def test_cannot_add_group_diff_without_two_groups(self):
        self.presenter.group_widget.handle_add_diff_button_clicked(
        )  # No groups
        group0 = MuonGroup(group_name="group_0", detector_ids=[1])
        self.model.add_group(group0)
        self.presenter.group_widget.handle_add_diff_button_clicked()  # 1 group
        group1 = MuonGroup(group_name="group_1", detector_ids=[2])
        self.model.add_group(group1)
        self.presenter.group_widget.handle_add_diff_button_clicked(
        )  # 2 groups
        self.assertEqual(2, self.presenter.group_view.warning_popup.call_count)

    def test_add_diff_button_adds_group_diff(self):
        self.add_two_groups()  # Required for a group diff
        self.presenter.group_widget.handle_add_diff_button_clicked()

        self.assertEqual(1, self.presenter.group_view.num_rows())
        self.assertEqual(1, len(self.model.diffs))
        self.assertEqual('group', self.model.diffs[0].group_or_pair)
        self.assertEqual("diff_0",
                         self.presenter.group_view.get_table_item_text(
                             self.presenter.group_view.num_rows() - 1,
                             0))  # Check added to end of table
        self.assertEqual(
            0, self.presenter.pair_view.num_rows())  # Check no pair diffs

    def test_add_two_pair_diffs_function(self):
        self.add_two_pair_diffs()

        self.assertEqual(2, self.presenter.pair_view.num_rows())
        self.assertEqual("pair_diff_0",
                         self.presenter.pair_view.get_table_item_text(0, 0))
        self.assertEqual("pair_diff_1",
                         self.presenter.pair_view.get_table_item_text(1, 0))

    def test_cannot_add_pair_diff_without_two_pairs(self):
        self.presenter.pair_widget.handle_add_diff_button_clicked()  # No pairs
        pair0 = MuonPair(pair_name="pair_0",
                         forward_group_name="group_1",
                         backward_group_name="group_0",
                         alpha=1.0)
        self.model.add_pair(pair0)
        self.presenter.pair_widget.handle_add_diff_button_clicked()  # 1 pair
        pair1 = MuonPair(pair_name="pair_1",
                         forward_group_name="group_0",
                         backward_group_name="group_1",
                         alpha=1.0)
        self.model.add_pair(pair1)
        self.presenter.pair_widget.handle_add_diff_button_clicked()  # 2 pairs
        self.assertEqual(2, self.presenter.pair_view.warning_popup.call_count)

    def test_add_diff_button_adds_pair_diff(self):
        self.add_two_pairs()  # Required for a pair diff
        self.presenter.pair_widget.handle_add_diff_button_clicked()

        self.assertEqual(1, self.presenter.pair_view.num_rows())
        self.assertEqual(1, len(self.model.diffs))
        self.assertEqual('pair', self.model.diffs[0].group_or_pair)
        self.assertEqual("diff_0",
                         self.presenter.pair_view.get_table_item_text(
                             self.presenter.pair_view.num_rows() - 1,
                             0))  # Check added to end of table
        self.assertEqual(
            0, self.presenter.group_view.num_rows())  # Check no group diffs

    def test_remove_diff_button(self):
        self.add_two_group_diffs()
        self.presenter.group_widget.handle_remove_diff_button_clicked()

        self.assertEqual(1, self.presenter.group_view.num_rows())
        self.assertEqual(
            "group_diff_0",
            self.presenter.group_view.get_table_item_text(
                self.presenter.group_view.num_rows() - 1, 0))

    def test_remove_diff_button_when_diffs_are_selected(self):
        self.add_two_group_diffs()
        self.presenter.group_view.get_selected_diff_names = mock.Mock(
            return_value=['group_diff_0'])
        self.presenter.group_widget.handle_remove_diff_button_clicked()

        self.assertEqual(
            "group_diff_1",
            self.presenter.group_view.get_table_item_text(
                self.presenter.group_view.num_rows() - 1, 0))

    def test_remove_diff_button_when_table_is_empty_does_not_throw(self):
        self.presenter.group_widget.handle_remove_diff_button_clicked()
        self.assertEqual(0, self.presenter.group_view.warning_popup.call_count)

    # ------------------------------------------------------------------------------------------------------------------
    # TESTS : Context menu has "add diff" and "remove diff" functionality
    # ------------------------------------------------------------------------------------------------------------------

    def test_context_menu_adds_diff_with_no_rows_selected(self):
        self.add_two_groups()  # Required for a group diff
        self.presenter.group_view.contextMenuEvent(0)
        self.presenter.group_view.add_diff_action.triggered.emit(True)

        self.assertEqual(1, self.presenter.group_view.num_rows())
        self.assertEqual("diff_0",
                         self.presenter.group_view.get_table_item_text(0, 0))

    def test_context_menu_does_not_allow_add_diff_if_rows_selected(self):
        self.presenter.group_view._get_selected_row_indices = mock.Mock(
            return_value=[0])
        self.presenter.group_view.contextMenuEvent(0)

        self.assertFalse(self.presenter.group_view.add_diff_action.isEnabled())

    def test_context_menu_remove_diff_with_no_selected_rows(self):
        self.add_two_group_diffs()
        self.presenter.group_view.contextMenuEvent(0)
        self.presenter.group_view.remove_diff_action.triggered.emit(True)

        self.assertEqual(1, len(self.model.diffs))
        self.assertEqual(1, self.presenter.group_view.num_rows())
        self.assertEqual('group_diff_0',
                         self.presenter.group_view.get_table_item_text(0, 0))

    def test_context_menu_removes_selected_diffs(self):
        self.add_two_group_diffs()
        self.presenter.group_view._get_selected_row_indices = mock.Mock(
            return_value=[0])
        self.presenter.group_view.contextMenuEvent(0)
        self.presenter.group_view.remove_diff_action.triggered.emit(True)

        self.assertEqual(1, len(self.model.diffs))
        self.assertEqual(1, self.presenter.group_view.num_rows())
        self.assertEqual('group_diff_1',
                         self.presenter.group_view.get_table_item_text(0, 0))

    def test_context_menu_cannot_remove_diff_if_no_diffs_in_table(self):
        self.presenter.group_view.contextMenuEvent(0)
        self.assertFalse(
            self.presenter.group_view.remove_diff_action.isEnabled())

    # ------------------------------------------------------------------------------------------------------------------
    # Diff name validation
    # ------------------------------------------------------------------------------------------------------------------

    def test_warning_using_duplicated_name(self):
        self.add_two_pair_diffs()

        self.presenter.group_view.enter_diff_name = mock.Mock(
            return_value="group_0")  # Diff name same as group
        self.presenter.group_widget.handle_add_diff_button_clicked()

        self.presenter.pair_view.enter_diff_name = mock.Mock(
            return_value="pair_0")  # Diff name same as pair
        self.presenter.pair_widget.handle_add_diff_button_clicked()

        self.presenter.pair_view.enter_diff_name = mock.Mock(
            return_value="pair_diff_0")  # Diff name same as diff
        self.presenter.pair_widget.handle_add_diff_button_clicked()

        self.presenter.pair_view.enter_diff_name = mock.Mock(
            return_value="new_diff")  # New diff name
        self.presenter.pair_widget.handle_add_diff_button_clicked()

        self.assertEqual(1, self.presenter.group_view.warning_popup.call_count
                         )  # Group name duplicated
        self.assertEqual(2, self.presenter.pair_view.warning_popup.call_count
                         )  # Pair and Diff name duplicated