Merge lp:~ken-vandine/ubuntu-system-settings/default_sim_as into lp:ubuntu-system-settings

Proposed by Ken VanDine
Status: Merged
Approved by: Jonas G. Drange
Approved revision: 1628
Merged at revision: 1635
Proposed branch: lp:~ken-vandine/ubuntu-system-settings/default_sim_as
Merge into: lp:ubuntu-system-settings
Diff against target: 554 lines (+291/-49)
9 files modified
plugins/cellular/CMakeLists.txt (+3/-0)
plugins/cellular/Components/DefaultSim.qml (+5/-0)
plugins/cellular/Components/MultiSim.qml (+2/-2)
plugins/cellular/cellular.cpp (+119/-0)
plugins/cellular/cellular.h (+69/-0)
plugins/cellular/plugin.cpp (+3/-0)
src/accountsservice.cpp (+2/-1)
tests/autopilot/ubuntu_system_settings/tests/__init__.py (+73/-10)
tests/autopilot/ubuntu_system_settings/tests/test_cellular.py (+15/-36)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-system-settings/default_sim_as
Reviewer Review Type Date Requested Status
Jonas G. Drange (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+288531@code.launchpad.net

Commit message

Ported DefaultSimForCalls, DefaultSimForMessages and SimNames to use AccountsService

Description of the change

Ported DefaultSimForCalls, DefaultSimForMessages and SimNames to use AccountsService

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1608. By Ken VanDine

link accountsservice

1609. By Ken VanDine

UbuntuCellularPanel shouldn't be a singleton

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1610. By Ken VanDine

SimNames is a QVariantMap

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1611. By Ken VanDine

Convert from QVariantMap to QMap<QString,QString> for simNames

1612. By Ken VanDine

Added some debug output

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1613. By Ken VanDine

Properly convert SimNames to a QVariantMap

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1614. By Ken VanDine

Fixed SimNames based on work from Tiago

1615. By Ken VanDine

Added debugging

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1616. By Ken VanDine

Updated tests to work with AccountsService

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1617. By Ken VanDine

tearDown the phone accountsservice mocks

1618. By Ken VanDine

sleep after starting the mock

1619. By Ken VanDine

removed some debug logging

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1620. By Ken VanDine

Added some debug output

1621. By Ken VanDine

Added test_remote_manipulation_of_name back, not working yet though

1622. By Ken VanDine

Ensure we emit PropertyChanged for changed_properties not only invalidated_properties

1623. By Ken VanDine

added some debugging output

1624. By Ken VanDine

Only emit PropertyChanged

1625. By Ken VanDine

removed unused line

1626. By Ken VanDine

Don't emit changed signals in our setters, those get propagated from AS

1627. By Ken VanDine

make pep8 happpy again

1628. By Ken VanDine

removed debug logging

Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

Works well and looks good. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/cellular/CMakeLists.txt'
2--- plugins/cellular/CMakeLists.txt 2015-08-28 10:28:28 +0000
3+++ plugins/cellular/CMakeLists.txt 2016-03-21 18:29:27 +0000
4@@ -21,6 +21,8 @@
5 add_library(UbuntuCellularPanel MODULE
6 plugin.cpp
7 plugin.h
8+ cellular.cpp
9+ cellular.h
10 connectivity.cpp
11 connectivity.h
12 nm_manager_proxy.h
13@@ -28,6 +30,7 @@
14 nm_settings_connection_proxy.h
15 ${QML_SOURCES}
16 )
17+target_link_libraries(UbuntuCellularPanel uss-accountsservice)
18 qt5_use_modules(UbuntuCellularPanel Qml Quick DBus)
19
20 set(PLUG_DIR ${PLUGIN_PRIVATE_MODULE_DIR}/Ubuntu/SystemSettings/Cellular)
21
22=== modified file 'plugins/cellular/Components/DefaultSim.qml'
23--- plugins/cellular/Components/DefaultSim.qml 2015-08-10 13:31:45 +0000
24+++ plugins/cellular/Components/DefaultSim.qml 2016-03-21 18:29:27 +0000
25@@ -21,6 +21,7 @@
26 import SystemSettings 1.0
27 import Ubuntu.Components 1.3
28 import Ubuntu.Components.ListItems 1.3 as ListItem
29+import Ubuntu.SystemSettings.Cellular 1.0
30
31 Column {
32
33@@ -32,6 +33,10 @@
34 return [i18n.tr("Ask me each time"), sims[0].title, sims[1].title][index];
35 }
36
37+ UbuntuCellularPanel {
38+ id: phoneSettings
39+ }
40+
41 SettingsItemTitle { text: i18n.tr("For outgoing calls, use:") }
42
43 ListItem.ItemSelector {
44
45=== modified file 'plugins/cellular/Components/MultiSim.qml'
46--- plugins/cellular/Components/MultiSim.qml 2015-09-18 14:18:11 +0000
47+++ plugins/cellular/Components/MultiSim.qml 2016-03-21 18:29:27 +0000
48@@ -22,6 +22,7 @@
49 import SystemSettings 1.0
50 import Ubuntu.Components 1.3
51 import Ubuntu.Components.ListItems 1.3 as ListItem
52+import Ubuntu.SystemSettings.Cellular 1.0
53
54 /* This is a temporary solution to the issue of Hotspots failing on mako. If
55 the device is mako, we hide the hotspot entry. Will be removed once lp:1434591
56@@ -149,9 +150,8 @@
57 }
58
59
60- GSettings {
61+ UbuntuCellularPanel {
62 id: phoneSettings
63- schema.id: "com.ubuntu.phone"
64 Component.onCompleted: {
65 // set default names
66 var simNames = phoneSettings.simNames;
67
68=== added file 'plugins/cellular/cellular.cpp'
69--- plugins/cellular/cellular.cpp 1970-01-01 00:00:00 +0000
70+++ plugins/cellular/cellular.cpp 2016-03-21 18:29:27 +0000
71@@ -0,0 +1,119 @@
72+/*
73+ * Copyright (C) 2016 Canonical Ltd
74+ *
75+ * This program is free software: you can redistribute it and/or modify
76+ * it under the terms of the GNU General Public License version 3 as
77+ * published by the Free Software Foundation.
78+ *
79+ * This program is distributed in the hope that it will be useful,
80+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
81+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82+ * GNU General Public License for more details.
83+ *
84+ * You should have received a copy of the GNU General Public License
85+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
86+ *
87+ * Authors:
88+ * Ken VanDine <ken.vandine@canonical.com>
89+ *
90+*/
91+
92+#include "cellular.h"
93+#include <QDebug>
94+#include <QDBusReply>
95+
96+#define AS_INTERFACE "com.ubuntu.touch.AccountsService.Phone"
97+
98+Cellular::Cellular(QObject *parent) :
99+ QObject(parent)
100+{
101+ connect (&m_accountsService,
102+ SIGNAL (propertyChanged (QString, QString)),
103+ this,
104+ SLOT (slotChanged (QString, QString)));
105+
106+ connect (&m_accountsService,
107+ SIGNAL (nameOwnerChanged()),
108+ this,
109+ SLOT (slotNameOwnerChanged()));
110+}
111+
112+void Cellular::slotChanged(QString interface,
113+ QString property)
114+{
115+ if (interface != AS_INTERFACE)
116+ return;
117+
118+ if (property == "DefaultSimForCalls") {
119+ Q_EMIT defaultSimForCallsChanged();
120+ } else if (property == "DefaultSimForMessages") {
121+ Q_EMIT defaultSimForMessagesChanged();
122+ } else if (property == "SimNames") {
123+ Q_EMIT simNamesChanged();
124+ }
125+}
126+
127+void Cellular::slotNameOwnerChanged()
128+{
129+ // Tell QML so that it refreshes its view of the property
130+ Q_EMIT defaultSimForCallsChanged();
131+ Q_EMIT defaultSimForMessagesChanged();
132+ Q_EMIT simNamesChanged();
133+}
134+
135+QString Cellular::getDefaultSimForCalls()
136+{
137+ return m_accountsService.getUserProperty(AS_INTERFACE,
138+ "DefaultSimForCalls").toString();
139+}
140+
141+void Cellular::setDefaultSimForCalls(QString sim)
142+{
143+ if (sim == getDefaultSimForCalls())
144+ return;
145+
146+ m_accountsService.setUserProperty(AS_INTERFACE,
147+ "DefaultSimForCalls",
148+ QVariant::fromValue(sim));
149+}
150+
151+QString Cellular::getDefaultSimForMessages()
152+{
153+ return m_accountsService.getUserProperty(AS_INTERFACE,
154+ "DefaultSimForMessages").toString();
155+}
156+
157+void Cellular::setDefaultSimForMessages(QString sim)
158+{
159+ if (sim == getDefaultSimForMessages())
160+ return;
161+
162+ m_accountsService.setUserProperty(AS_INTERFACE,
163+ "DefaultSimForMessages",
164+ QVariant::fromValue(sim));
165+}
166+
167+QVariantMap Cellular::getSimNames()
168+{
169+ QVariantMap namesAsVariantMap;
170+ QVariant value = m_accountsService.getUserProperty(AS_INTERFACE, "SimNames");
171+ // the signature is a{ss} instead of a{sv}
172+ QMap<QString, QString> names = qdbus_cast<QMap<QString, QString> >(value);
173+ QMapIterator<QString, QString> i(names);
174+ while (i.hasNext()) {
175+ i.next();
176+ namesAsVariantMap[i.key()] = i.value();
177+ }
178+ return namesAsVariantMap;
179+}
180+
181+void Cellular::setSimNames(QVariantMap sims)
182+{
183+ QMap<QString, QString> map;
184+ for(QVariantMap::const_iterator iter = sims.begin(); iter != sims.end(); ++iter) {
185+ map.insert(iter.key(), iter.value().toString());
186+ }
187+ m_accountsService.setUserProperty(AS_INTERFACE,
188+ "SimNames",
189+ QVariant::fromValue(map));
190+}
191
192=== added file 'plugins/cellular/cellular.h'
193--- plugins/cellular/cellular.h 1970-01-01 00:00:00 +0000
194+++ plugins/cellular/cellular.h 2016-03-21 18:29:27 +0000
195@@ -0,0 +1,69 @@
196+/*
197+ * Copyright (C) 2016 Canonical Ltd
198+ *
199+ * This program is free software: you can redistribute it and/or modify
200+ * it under the terms of the GNU General Public License version 3 as
201+ * published by the Free Software Foundation.
202+ *
203+ * This program is distributed in the hope that it will be useful,
204+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
205+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
206+ * GNU General Public License for more details.
207+ *
208+ * You should have received a copy of the GNU General Public License
209+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
210+ *
211+ * Authors:
212+ * Ken VanDine <ken.vandine@canonical.com>
213+ *
214+*/
215+
216+#ifndef CELLULAR_H
217+#define CELLULAR_H
218+
219+#include "accountsservice.h"
220+
221+#include <QObject>
222+#include <QVariantMap>
223+
224+class Cellular : public QObject
225+{
226+ Q_OBJECT
227+
228+public:
229+ explicit Cellular(QObject *parent = 0);
230+ Q_PROPERTY (QString defaultSimForCalls
231+ READ getDefaultSimForCalls
232+ WRITE setDefaultSimForCalls
233+ NOTIFY defaultSimForCallsChanged)
234+ Q_PROPERTY (QString defaultSimForMessages
235+ READ getDefaultSimForMessages
236+ WRITE setDefaultSimForMessages
237+ NOTIFY defaultSimForMessagesChanged)
238+ Q_PROPERTY (QVariantMap simNames
239+ READ getSimNames
240+ WRITE setSimNames
241+ NOTIFY simNamesChanged)
242+
243+public Q_SLOTS:
244+ void slotChanged(QString, QString);
245+ void slotNameOwnerChanged();
246+
247+Q_SIGNALS:
248+ void defaultSimForCallsChanged();
249+ void defaultSimForMessagesChanged();
250+ void simNamesChanged();
251+
252+private:
253+ AccountsService m_accountsService;
254+
255+ QString getDefaultSimForCalls();
256+ void setDefaultSimForCalls(QString sim);
257+ QString getDefaultSimForMessages();
258+ void setDefaultSimForMessages(QString sim);
259+ QVariantMap getSimNames();
260+ void setSimNames(QVariantMap names);
261+
262+};
263+
264+#endif // CELLULAR_H
265
266=== modified file 'plugins/cellular/plugin.cpp'
267--- plugins/cellular/plugin.cpp 2015-08-06 10:33:16 +0000
268+++ plugins/cellular/plugin.cpp 2016-03-21 18:29:27 +0000
269@@ -19,6 +19,7 @@
270
271 #include <QtQml>
272 #include <QtQml/QQmlContext>
273+#include "cellular.h"
274 #include "connectivity.h"
275
276 static QObject *connectivitySingeltonProvider(QQmlEngine *engine, QJSEngine *scriptEngine)
277@@ -34,6 +35,8 @@
278 {
279 Q_ASSERT(uri == QLatin1String("Ubuntu.SystemSettings.Cellular"));
280 qmlRegisterSingletonType<Connectivity>(uri, 1, 0, "Connectivity", connectivitySingeltonProvider);
281+ qmlRegisterType<Cellular>(uri, 1, 0, "UbuntuCellularPanel");
282+
283 }
284
285 void BackendPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
286
287=== modified file 'src/accountsservice.cpp'
288--- src/accountsservice.cpp 2014-09-08 19:12:35 +0000
289+++ src/accountsservice.cpp 2016-03-21 18:29:27 +0000
290@@ -53,7 +53,8 @@
291 QVariantMap changed_properties,
292 QStringList invalidated_properties)
293 {
294- Q_UNUSED (changed_properties);
295+ Q_FOREACH (const QString k, changed_properties.keys())
296+ Q_EMIT propertyChanged(interface, k);
297
298 Q_FOREACH (const QString prop, invalidated_properties)
299 Q_EMIT propertyChanged(interface, prop);
300
301=== modified file 'tests/autopilot/ubuntu_system_settings/tests/__init__.py'
302--- tests/autopilot/ubuntu_system_settings/tests/__init__.py 2016-02-25 11:25:55 +0000
303+++ tests/autopilot/ubuntu_system_settings/tests/__init__.py 2016-03-21 18:29:27 +0000
304@@ -50,6 +50,7 @@
305 ACCOUNTS_OBJ = '/org/freedesktop/Accounts'
306 ACCOUNTS_SERVICE = 'com.canonical.unity.AccountsService'
307 ACCOUNTS_SOUND_IFACE = 'com.ubuntu.touch.AccountsService.Sound'
308+ACCOUNTS_PHONE_IFACE = 'com.ubuntu.touch.AccountsService.Phone'
309 INDICATOR_NETWORK = 'indicator-network'
310 ISOUND_SERVICE = 'com.canonical.indicator.sound'
311 ISOUND_ACTION_PATH = '/com/canonical/indicator/sound'
312@@ -429,16 +430,6 @@
313
314 super(UbuntuSystemSettingsOfonoTestCase, self).setUp()
315
316- def set_default_for_calls(self, gsettings, default):
317- gsettings.set_value('default-sim-for-calls', default)
318- # wait for gsettings
319- sleep(1)
320-
321- def set_default_for_messages(self, gsettings, default):
322- gsettings.set_value('default-sim-for-messages', default)
323- # wait for gsettings
324- sleep(1)
325-
326 def get_default_sim_for_calls_selector(self, text):
327 return self.cellular_page.select_single(
328 objectName="defaultForCalls" + text
329@@ -454,6 +445,73 @@
330
331 def setUp(self):
332 """ Go to Cellular page """
333+
334+ user_obj = '/user/foo'
335+
336+ self.accts_phone_props = {
337+ 'DefaultSimForCalls': dbus.String("/ril_0", variant_level=1),
338+ 'DefaultSimForMessages': dbus.String("/ril_1", variant_level=1),
339+ 'SimNames': dbus.Dictionary({}, signature='ss', variant_level=1)}
340+
341+ # start dbus system bus
342+ self.mock_server = self.spawn_server(ACCOUNTS_IFACE, ACCOUNTS_OBJ,
343+ ACCOUNTS_IFACE, system_bus=True,
344+ stdout=subprocess.PIPE)
345+ # give it time to ensure the mock is up
346+ sleep(1)
347+
348+ self.wait_for_bus_object(ACCOUNTS_IFACE,
349+ ACCOUNTS_OBJ,
350+ system_bus=True)
351+
352+ self.dbus_mock = dbus.Interface(self.dbus_con.get_object(
353+ ACCOUNTS_IFACE,
354+ ACCOUNTS_OBJ,
355+ ACCOUNTS_IFACE),
356+ dbusmock.MOCK_IFACE)
357+
358+ # let accountservice find a user object path
359+ self.dbus_mock.AddMethod(ACCOUNTS_IFACE, 'FindUserById', 'x', 'o',
360+ 'ret = "%s"' % user_obj)
361+
362+ self.dbus_mock.AddProperties(ACCOUNTS_PHONE_IFACE,
363+ self.accts_phone_props)
364+
365+ # add getter and setter to mock
366+ self.dbus_mock.AddMethods(
367+ 'org.freedesktop.DBus.Properties',
368+ [
369+ ('self.Get',
370+ 's',
371+ 'v',
372+ 'ret = self.accts_phone_props[args[0]]'),
373+ ('self.Set',
374+ 'sv',
375+ '',
376+ 'self.accts_phone_props[args[0]] = args[1]')
377+ ])
378+
379+ # add user object to mock
380+ self.dbus_mock.AddObject(
381+ user_obj, ACCOUNTS_PHONE_IFACE, self.accts_phone_props,
382+ [
383+ (
384+ 'GetDefaultSimForCalls', '', 'v',
385+ 'ret = self.Get("%s", "DefaultSimForCalls")' %
386+ ACCOUNTS_PHONE_IFACE),
387+ (
388+ 'GetDefaultSimForMessages', '', 'v',
389+ 'ret = self.Get("%s", "DefaultSimForMessages")' %
390+ ACCOUNTS_PHONE_IFACE),
391+ (
392+ 'GetSimNames', '', 'v',
393+ 'ret = self.Get("%s", "SimNames")' %
394+ ACCOUNTS_PHONE_IFACE)
395+ ])
396+
397+ self.obj_phone = self.dbus_con.get_object(ACCOUNTS_IFACE, user_obj,
398+ ACCOUNTS_IFACE)
399+
400 super(CellularBaseTestCase, self).setUp()
401 self.cellular_page = self.main_view.go_to_cellular_page()
402
403@@ -467,6 +525,11 @@
404 for key, value in kwargs.items():
405 context.SetProperty(key, value)
406
407+ def tearDown(self):
408+ self.mock_server.terminate()
409+ self.mock_server.wait()
410+ super(CellularBaseTestCase, self).tearDown()
411+
412
413 class HotspotBaseTestCase(UbuntuSystemSettingsHotspotTestCase):
414
415
416=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_cellular.py'
417--- tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2015-08-12 14:46:07 +0000
418+++ tests/autopilot/ubuntu_system_settings/tests/test_cellular.py 2016-03-21 18:29:27 +0000
419@@ -5,8 +5,7 @@
420 # under the terms of the GNU General Public License version 3, as published
421 # by the Free Software Foundation.
422
423-from gi.repository import Gio, GLib
424-from time import sleep
425+import dbus
426
427 from autopilot.introspection.dbus import StateNotFoundError
428 from autopilot.matchers import Eventually
429@@ -14,7 +13,7 @@
430
431 from ubuntu_system_settings.tests import (
432 CellularBaseTestCase, CONNMAN_IFACE, RDO_IFACE,
433- NETREG_IFACE)
434+ NETREG_IFACE, ACCOUNTS_PHONE_IFACE)
435
436
437 DEV_IFACE = 'org.freedesktop.NetworkManager.Device'
438@@ -173,10 +172,10 @@
439 self.cellular_page.change_carrier('my.cool.telco', sim=sim)
440
441 def test_change_sim1_name(self):
442- gsettings = Gio.Settings.new('com.ubuntu.phone')
443+
444 sim = '/ril_0'
445 try:
446- old_name = gsettings.get_value('sim-names')[sim]
447+ old_name = self.obj_phone.GetSimNames()[sim]
448 except:
449 old_name = 'SIM 1'
450 new_name = 'FOO BAR'
451@@ -184,21 +183,18 @@
452
453 try:
454 self.assertThat(
455- lambda: gsettings.get_value('sim-names')[sim],
456+ lambda: self.obj_phone.GetSimNames()[sim],
457 Eventually(Equals(new_name)))
458 except Exception as e:
459 raise e
460 finally:
461 self.cellular_page.set_name(sim, old_name)
462- # wait for gsettings
463- sleep(1)
464
465 def test_change_sim2_name(self):
466- gsettings = Gio.Settings.new('com.ubuntu.phone')
467 sim = '/ril_1'
468
469 try:
470- old_name = gsettings.get_value('sim-names')[sim]
471+ old_name = self.obj_phone.GetSimNames()[sim]
472 except:
473 old_name = 'SIM 2'
474
475@@ -207,34 +203,29 @@
476
477 try:
478 self.assertThat(
479- lambda: gsettings.get_value('sim-names')[sim],
480+ lambda: self.obj_phone.GetSimNames()[sim],
481 Eventually(Equals(new_name)))
482 except Exception as e:
483 raise e
484 finally:
485 self.cellular_page.set_name(sim, old_name)
486- # wait for gsettings
487- sleep(1)
488
489 def test_remote_manipulation_of_name(self):
490- gsettings = Gio.Settings.new('com.ubuntu.phone')
491- old_names = gsettings.get_value('sim-names')
492+ old_names = self.obj_phone.GetSimNames()
493 sim = '/ril_0'
494 name = 'BAS QUX'
495- new_names = old_names.unpack()
496+ new_names = old_names
497 new_names[sim] = name
498- new_names = GLib.Variant('a{ss}', new_names)
499- gsettings.set_value('sim-names', new_names)
500+ self.obj_phone.Set(ACCOUNTS_PHONE_IFACE, "SimNames", new_names)
501+ self.dbus_mock.EmitSignal(ACCOUNTS_PHONE_IFACE, "PropertyChanged",
502+ "sv", dbus.Array(["SimNames", new_names]))
503+
504 try:
505 self.assertThat(
506 lambda: self.cellular_page.get_name(sim),
507 Eventually(StartsWith(name)))
508 except Exception as e:
509 raise e
510- finally:
511- gsettings.set_value('sim-names', old_names)
512- # wait for gsettings
513- sleep(1)
514
515 def test_roaming_switch(self):
516 self.cellular_page.disable_datas()
517@@ -267,12 +258,6 @@
518 Eventually(Equals(True)))
519
520 def test_changing_default_sim_for_calls(self):
521- gsettings = Gio.Settings.new('com.ubuntu.phone')
522- default = gsettings.get_value('default-sim-for-calls')
523-
524- self.addCleanup(
525- self.set_default_for_calls, gsettings, default)
526-
527 # click ask
528 self.system_settings.main_view.scroll_to_and_click(
529 self.get_default_sim_for_calls_selector('ask'))
530@@ -281,15 +266,10 @@
531 self.get_default_sim_for_calls_selector('/ril_0'))
532
533 self.assertThat(
534- lambda: gsettings.get_value('default-sim-for-calls').get_string(),
535+ lambda: self.obj_phone.GetDefaultSimForCalls(),
536 Eventually(Equals('/ril_0')))
537
538 def test_changing_default_sim_for_messages(self):
539- gsettings = Gio.Settings.new('com.ubuntu.phone')
540- default = gsettings.get_value('default-sim-for-messages')
541- self.addCleanup(
542- self.set_default_for_messages, gsettings, default)
543-
544 # click ask
545 self.system_settings.main_view.scroll_to_and_click(
546 self.get_default_sim_for_messages_selector('ask'))
547@@ -298,8 +278,7 @@
548 self.get_default_sim_for_messages_selector('/ril_1'))
549
550 self.assertThat(
551- lambda:
552- gsettings.get_value('default-sim-for-messages').get_string(),
553+ lambda: self.obj_phone.GetDefaultSimForMessages(),
554 Eventually(Equals('/ril_1')))
555
556

Subscribers

People subscribed via source and target branches