Beispiel #1
0
    def setUp(self):
        if is_process_running(INDICATOR_NETWORK):
            _stop_process(INDICATOR_NETWORK)
            self.addCleanup(_start_process, INDICATOR_NETWORK)

        ctv_tmpl = os.path.join(os.path.dirname(__file__), 'connectivity.py')
        (self.ctv_mock, self.obj_ctv) = self.spawn_server_template(
            ctv_tmpl,
            parameters=self.connectivity_parameters,
            stdout=subprocess.PIPE)

        self.ctv_private = dbus.Interface(
            self.session_con.get_object(CTV_IFACE, CTV_PRIV_OBJ),
            'org.freedesktop.DBus.Properties')

        self.ctv_nets = dbus.Interface(
            self.session_con.get_object(CTV_IFACE, CTV_NETS_OBJ),
            'org.freedesktop.DBus.Properties')

        inetwork = os.path.join(os.path.dirname(__file__),
                                'indicatornetwork.py')
        (self.inetwork_mock, self.obj_inetwork) = self.spawn_server_template(
            inetwork,
            parameters=self.indicatornetwork_parameters,
            stdout=subprocess.PIPE)

        # Required since this test needs to dismiss the OSK.
        self.useFixture(EnvironmentVariable("UITK_USE_MALIIT", "1"))

        super(UbuntuSystemSettingsHotspotTestCase, self).setUp()
Beispiel #2
0
    def setUp(self):
        if is_process_running(INDICATOR_NETWORK):
            _stop_process(INDICATOR_NETWORK)
            self.addCleanup(_start_process, INDICATOR_NETWORK)

        ctv_tmpl = os.path.join(os.path.dirname(__file__), 'connectivity.py')
        (self.ctv_mock, self.obj_ctv) = self.spawn_server_template(
            ctv_tmpl,
            parameters=self.connectivity_parameters,
            stdout=subprocess.PIPE)

        self.ctv_private = dbus.Interface(
            self.session_con.get_object(CTV_IFACE, CTV_PRIV_OBJ),
            'org.freedesktop.DBus.Properties')

        super(UbuntuSystemSettingsVpnTestCase, self).setUp()
Beispiel #3
0
    def setUp(self, panel=None):
        if is_process_running(INDICATOR_NETWORK):
            _stop_process(INDICATOR_NETWORK)
            self.addCleanup(_start_process, INDICATOR_NETWORK)

        inetwork = os.path.join(os.path.dirname(__file__),
                                'indicatornetwork.py')
        (self.inetwork_mock, self.obj_inetwork) = self.spawn_server_template(
            inetwork,
            parameters=self.indicatornetwork_parameters,
            stdout=subprocess.PIPE)

        self.obj_nm.Reset()

        # Add a mock NetworkManager environment so we get consistent results
        self.device_path = self.obj_nm.AddWiFiDevice('test0', 'Barbaz', 1)
        self.device_mock = dbus.Interface(
            self.dbus_con.get_object(NM_SERVICE, self.device_path),
            dbusmock.MOCK_IFACE)

        self.ap_mock = self.create_access_point(
            'test_ap',
            'test_ap',
            security=NM80211ApSecurityFlags.NM_802_11_AP_SEC_KEY_MGMT_PSK)

        # Required since this test needs to dismiss the OSK.
        self.useFixture(EnvironmentVariable("UITK_USE_MALIIT", "1"))

        super(WifiBaseTestCase, self).setUp(panel)
        if panel:
            self.wifi_page = self.main_view.wait_select_single(
                objectName='wifiPage')
        else:
            self.wifi_page = self.main_view.go_to_wifi_page()

        self.wifi_page._scroll_to_and_click = \
            self.main_view.scroll_to_and_click
Beispiel #4
0
    def setUp(self):
        """Go to SystemUpdates Page."""
        self.clicksrv_manager = None
        if is_process_running(INDICATOR_NETWORK):
            _stop_process(INDICATOR_NETWORK)
            self.addCleanup(_start_process, INDICATOR_NETWORK)

        ctv_tmpl = os.path.join(os.path.dirname(__file__), 'connectivity.py')
        (self.ctv_mock, self.obj_ctv) = self.spawn_server_template(
            ctv_tmpl,
            parameters=self.connectivity_parameters,
            stdout=subprocess.PIPE)

        self.ctv_nets = dbus.Interface(
            self.session_con.get_object(CTV_IFACE, CTV_NETS_OBJ),
            'org.freedesktop.DBus.Properties')

        if self.click_server_parameters['start']:
            self.clicksrv_manager = Manager(
                responses=self.click_server_parameters.get('responses', None))
            self.clicksrv_manager.start()

        super(SystemUpdatesBaseTestCase, self).setUp()
        self.main_view.click_item('entryComponent-system-update')
Beispiel #5
0
    def setUp(self):
        """ Go to Cellular page """

        self.session_con = self.get_dbus(False)

        if is_process_running(INDICATOR_NETWORK):
            _stop_process(INDICATOR_NETWORK)
            self.addCleanup(_start_process, INDICATOR_NETWORK)

        ctv_tmpl = os.path.join(os.path.dirname(__file__), 'connectivity.py')
        (self.ctv_mock, self.obj_ctv) = self.spawn_server_template(
            ctv_tmpl,
            parameters=self.connectivity_parameters,
            stdout=subprocess.PIPE)

        sleep(1)

        self.ctv_private = dbus.Interface(
            self.session_con.get_object(CTV_IFACE, CTV_PRIV_OBJ),
            'org.freedesktop.DBus.Properties')

        sim = self.obj_ctv.AddSim("1234567890")
        self.ctv_private.Set(CON_IFACE, 'Sims', dbus.Array([sim],
                                                           signature='o'))
        modem = self.obj_ctv.AddModem("0987654321", 1, sim)
        self.ctv_private.Set(CON_IFACE, 'Modems',
                             dbus.Array([modem], signature='o'))

        self.ctv_modem0 = dbus.Interface(
            self.session_con.get_object(CTV_IFACE, modem),
            'org.freedesktop.DBus.Properties')
        self.ctv_sim0 = dbus.Interface(
            self.session_con.get_object(CTV_IFACE, sim),
            'org.freedesktop.DBus.Properties')

        if self.use_sims == 2:
            sim2 = self.obj_ctv.AddSim("2345678901")
            self.ctv_private.Set(CON_IFACE, 'Sims',
                                 dbus.Array([sim, sim2], signature='o'))
            modem2 = self.obj_ctv.AddModem("1098765432", 2, sim2)
            self.ctv_private.Set(CON_IFACE, 'Modems',
                                 dbus.Array([modem, modem2], signature='o'))

            self.ctv_modem1 = dbus.Interface(
                self.session_con.get_object(CTV_IFACE, modem2),
                'org.freedesktop.DBus.Properties')
            self.ctv_sim1 = dbus.Interface(
                self.session_con.get_object(CTV_IFACE, sim2),
                'org.freedesktop.DBus.Properties')

        user_obj = '/user/foo'

        self.accts_phone_props = {
            'DefaultSimForCalls': dbus.String("/ril_0", variant_level=1),
            'DefaultSimForMessages': dbus.String("/ril_1", variant_level=1),
            'SimNames': dbus.Dictionary({}, signature='ss', variant_level=1)
        }

        # start dbus system bus
        self.mock_server = self.spawn_server(ACCOUNTS_IFACE,
                                             ACCOUNTS_OBJ,
                                             ACCOUNTS_IFACE,
                                             system_bus=True,
                                             stdout=subprocess.PIPE)
        # give it time to ensure the mock is up
        sleep(1)

        self.wait_for_bus_object(ACCOUNTS_IFACE, ACCOUNTS_OBJ, system_bus=True)

        self.dbus_mock = dbus.Interface(
            self.dbus_con.get_object(ACCOUNTS_IFACE, ACCOUNTS_OBJ,
                                     ACCOUNTS_IFACE), dbusmock.MOCK_IFACE)

        # let accountservice find a user object path
        self.dbus_mock.AddMethod(ACCOUNTS_IFACE, 'FindUserById', 'x', 'o',
                                 'ret = "%s"' % user_obj)

        self.dbus_mock.AddProperties(ACCOUNTS_PHONE_IFACE,
                                     self.accts_phone_props)

        # add getter and setter to mock
        self.dbus_mock.AddMethods('org.freedesktop.DBus.Properties', [
            ('self.Get', 's', 'v', 'ret = self.accts_phone_props[args[0]]'),
            ('self.Set', 'sv', '', 'self.accts_phone_props[args[0]] = args[1]')
        ])

        # add user object to mock
        self.dbus_mock.AddObject(
            user_obj, ACCOUNTS_PHONE_IFACE, self.accts_phone_props,
            [('GetDefaultSimForCalls', '', 'v',
              'ret = self.Get("%s", "DefaultSimForCalls")' %
              ACCOUNTS_PHONE_IFACE),
             ('GetDefaultSimForMessages', '', 'v',
              'ret = self.Get("%s", "DefaultSimForMessages")' %
              ACCOUNTS_PHONE_IFACE),
             ('GetSimNames', '', 'v',
              'ret = self.Get("%s", "SimNames")' % ACCOUNTS_PHONE_IFACE)])

        self.obj_phone = self.dbus_con.get_object(ACCOUNTS_IFACE, user_obj,
                                                  ACCOUNTS_IFACE)

        super(CellularBaseTestCase, self).setUp()
        self.cellular_page = self.main_view.go_to_cellular_page()