def test_one_connection_on_remove_confirm_positive(self):
     view = MockView(combos={"name_combo": [], "type_combo": []})
     prefs.prefs[bauble.conn_list_pref] = {
         "nugkui": {"default": True, "pictures": "nugkui", "type": "SQLite", "file": "nugkui.db"}
     }
     presenter = ConnMgrPresenter(view)
     presenter.view.reply_yes_no_dialog.append(True)
     presenter.on_remove_button_clicked("button")
     ## visibility swapped
     self.assertFalse(presenter.view.widget_get_visible("expander"))
     self.assertTrue(presenter.view.widget_get_visible("noconnectionlabel"))
 def test_one_connection_on_remove_confirm_negative(self):
     view = MockView(combos={'name_combo': [],
                             'type_combo': []})
     prefs.prefs[bauble.conn_list_pref] = {
         'nugkui': {'default': True,
                    'pictures': 'nugkui',
                    'type': 'SQLite',
                    'file': 'nugkui.db'}}
     presenter = ConnMgrPresenter(view)
     presenter.view.reply_yes_no_dialog.append(False)
     presenter.on_remove_button_clicked('button')
     ## nothing changes
     self.assertTrue(presenter.view.widget_get_visible(
         'expander'))
     self.assertFalse(presenter.view.widget_get_visible(
         'noconnectionlabel'))
 def test_one_connection_on_remove_confirm_negative(self):
     view = MockView(combos={'name_combo': [],
                             'type_combo': []})
     prefs.prefs[bauble.conn_list_pref] = {
         'nugkui': {'default': True,
                    'pictures': 'nugkui',
                    'type': 'SQLite',
                    'file': 'nugkui.db'}}
     presenter = ConnMgrPresenter(view)
     presenter.view.reply_yes_no_dialog.append(False)
     presenter.on_remove_button_clicked('button')
     ## nothing changes
     self.assertTrue(presenter.view.widget_get_visible(
         'expander'))
     self.assertFalse(presenter.view.widget_get_visible(
         'noconnectionlabel'))
 def test_two_connection_on_remove_confirm_positive(self):
     view = MockView(combos={'name_combo': [],
                             'type_combo': []})
     prefs.prefs[bauble.conn_list_pref] = {
         'nugkui': {'default': True,
                    'pictures': 'nugkui',
                    'type': 'SQLite',
                    'file': 'nugkui.db'},
         'btuu': {'default': True,
                  'pictures': 'btuu',
                  'type': 'SQLite',
                  'file': 'btuu.db'}}
     presenter = ConnMgrPresenter(view)
     presenter.view.reply_yes_no_dialog.append(True)
     presenter.on_remove_button_clicked('button')
     ## visibility same
     self.assertTrue(presenter.view.widget_get_visible(
         'expander'))
     self.assertFalse(presenter.view.widget_get_visible(
         'noconnectionlabel'))
     self.assertTrue('combobox_set_active' in view.invoked)
 def test_two_connection_on_remove_confirm_positive(self):
     view = MockView(combos={'name_combo': [],
                             'type_combo': []})
     prefs.prefs[bauble.conn_list_pref] = {
         'nugkui': {'default': True,
                    'pictures': 'nugkui',
                    'type': 'SQLite',
                    'file': 'nugkui.db'},
         'btuu': {'default': True,
                  'pictures': 'btuu',
                  'type': 'SQLite',
                  'file': 'btuu.db'}}
     presenter = ConnMgrPresenter(view)
     presenter.view.reply_yes_no_dialog.append(True)
     presenter.on_remove_button_clicked('button')
     ## visibility same
     self.assertTrue(presenter.view.widget_get_visible(
         'expander'))
     self.assertFalse(presenter.view.widget_get_visible(
         'noconnectionlabel'))
     self.assertTrue('combobox_set_active' in view.invoked)