392
391
self.cellular_page = self.main_view.go_to_cellular_page()
394
class HotspotBaseTestCase(CellularBaseTestCase):
398
super(HotspotBaseTestCase, cls).setUpClass()
399
nm_tmpl = os.path.join(os.path.dirname(__file__), 'networkmanager.py')
400
(cls.n_mock, cls.obj_nm) = cls.spawn_server_template(
401
nm_tmpl, stdout=subprocess.PIPE)
402
(cls.u_mock, cls.obj_urf) = cls.spawn_server_template(
403
'urfkill', stdout=subprocess.PIPE)
406
def tearDownClass(cls):
407
cls.n_mock.terminate()
409
cls.u_mock.terminate()
411
super(HotspotBaseTestCase, cls).tearDownClass()
415
self.urfkill_mock.ClearCalls()
416
super(HotspotBaseTestCase, self).tearDown()
419
self.patch_environment("USS_SHOW_ALL_UI", "1")
420
self.nm_mock = dbus.Interface(self.obj_nm, dbusmock.MOCK_IFACE)
421
self.device_path = self.obj_nm.AddWiFiDevice('test0', 'Barbaz', 1)
422
self.device_mock = dbus.Interface(self.dbus_con.get_object(
423
NM_SERVICE, self.device_path),
424
'org.freedesktop.DBus.Properties')
425
self.urfkill_mock = dbus.Interface(self.obj_urf, dbusmock.MOCK_IFACE)
426
super(HotspotBaseTestCase, self).setUp()
428
def add_hotspot(self, name, password, secured=True, enabled=False):
431
'id': dbus.String('Test AP', variant_level=1),
432
'type': dbus.String('802-11-wireless', variant_level=1), },
434
'mode': dbus.String('ap', variant_level=1),
435
'ssid': dbus.String(name, variant_level=1),
440
settings['802-11-wireless']['security'] = dbus.String(
441
'802-11-wireless-security', variant_level=1)
442
settings['802-11-wireless-security'] = {
443
'auth-alg': dbus.String('shared', variant_level=1),
444
'key-mgmt': dbus.String('wpa-psk', variant_level=1),
445
'psk': dbus.String(password, variant_level=1),
449
settings['connection']['autoconnect'] = True
451
connection_path = self.obj_nm.SettingsAddConnection(settings)
453
return connection_path
395
456
class BluetoothBaseTestCase(UbuntuSystemSettingsTestCase):