8
class TestMigrationAssistant(unittest.TestCase):
10
os.environ['UBIQUITY_MIGRATION_ASSISTANT'] = '1'
13
del os.environ['UBIQUITY_MIGRATION_ASSISTANT']
15
@mock.patch('ubiquity.misc.execute')
16
@mock.patch('ubiquity.misc.execute_root')
17
@mock.patch('ubiquity.misc.dmimodel')
18
@mock.patch('ubiquity.misc.drop_privileges')
19
@mock.patch('ubiquity.misc.regain_privileges')
20
@mock.patch('ubiquity.frontend.gtk_ui.Wizard.customize_installer')
21
@mock.patch('ubiquity.nm.wireless_hardware_present')
22
@mock.patch('ubiquity.nm.NetworkManager.start')
23
@mock.patch('ubiquity.nm.NetworkManager.get_state')
24
@mock.patch('ubiquity.misc.has_connection')
25
@mock.patch('ubiquity.upower.setup_power_watch')
26
@mock.patch('dbus.mainloop.glib.DBusGMainLoop')
27
@mock.patch('gi.repository.UbiquityWebcam.Webcam.available')
28
@mock.patch('ubiquity.i18n.reset_locale')
29
def test_sensible_treeview_size(self, mock_reset_locale, *args):
30
"""The tree view should show at least a sensible number of items."""
31
from ubiquity.frontend import gtk_ui
32
mock_reset_locale.return_value = 'en_US.UTF-8'
33
ui = gtk_ui.Wizard('test-ubiquity')
35
ma_page = [page for page in ui.pages
36
if page.module.NAME == 'migrationassistant'][0]
37
ui.set_page(ma_page.module.NAME)
39
for part in ('sda1', 'sda2', 'sda3', 'sda4'):
44
'items': ['Bookmarks', 'Documents'],
47
ma_page.ui.ma_set_choices(tree)
49
visible_range = ui.matreeview.get_visible_range()
50
if len(visible_range) == 3: # pygobject < 3.1.92
51
valid, start_path, end_path = visible_range
52
self.assertTrue(valid)
54
start_path, end_path = visible_range
55
self.assertEqual('0', start_path.to_string())
56
self.assertEqual('3', end_path.to_string())