Merge lp:~alextu/savilerow/test_custom_sound into lp:~ethan.chang/savilerow/test_custom_sound

Proposed by Alex Tu
Status: Merged
Merge reported by: Alex Tu
Merged at revision: not available
Proposed branch: lp:~alextu/savilerow/test_custom_sound
Merge into: lp:~ethan.chang/savilerow/test_custom_sound
Diff against target: 46 lines (+26/-5)
1 file modified
tests/api/test_custom_sound.py (+26/-5)
To merge this branch: bzr merge lp:~alextu/savilerow/test_custom_sound
Reviewer Review Type Date Requested Status
Ethan Chang Approve
Chris Wayne Pending
Review via email: mp+230569@code.launchpad.net

Description of the change

Modified the latest test case to check the synchronization between dconf and AccountsService by D-Bus interface.

To post a comment you must log in.
Revision history for this message
Ethan Chang (ethan.chang) wrote :

Tested the script on the N4, the script works well.

Revision history for this message
Ethan Chang (ethan.chang) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/api/test_custom_sound.py'
--- tests/api/test_custom_sound.py 2014-08-11 09:46:56 +0000
+++ tests/api/test_custom_sound.py 2014-08-13 03:15:14 +0000
@@ -1,5 +1,6 @@
1from autopilot.testcase import AutopilotTestCase1from autopilot.testcase import AutopilotTestCase
2import os2import os
3import dbus
3from gi.repository import Gio4from gi.repository import Gio
45
5#: Custom Ringtones/Notifications6#: Custom Ringtones/Notifications
@@ -36,11 +37,31 @@
3637
37 def test_custom_sounds_running(self):38 def test_custom_sounds_running(self):
38 """39 """
39 This test ensures that the custom ringtone and notification have been set as default40 This test ensures that the custom ringtone and notification which set in dconf database
40 sounds41 have been synced picked by AccountsService dbus object.
41 """42 """
42 settings = Gio.Settings('com.ubuntu.touch.sound')43 settings = Gio.Settings('com.ubuntu.touch.sound')
43 default_ringtone = settings.get_string('incoming-call-sound')44 dconf_ringtone = settings.get_string('incoming-call-sound')
44 default_notification = settings.get_string('incoming-message-sound')45 dconf_notification = settings.get_string('incoming-message-sound')
45 self.assertTrue(ringtone in default_ringtone,notification in default_notification) 46
47 # get the setting in dbus object.
48 system_bus = dbus.SystemBus()
49 manager_proxy = system_bus.get_object('org.freedesktop.Accounts',
50 '/org/freedesktop/Accounts')
51 object_path = manager_proxy.FindUserById(
52 os.getuid(), dbus_interface='org.freedesktop.Accounts'
53 )
54 user_proxy = system_bus.get_object('org.freedesktop.Accounts', object_path)
55
56 try:
57 notification = user_proxy.Get('com.ubuntu.touch.AccountsService.Sound', 'IncomingCallSound',
58 dbus_interface=dbus.PROPERTIES_IFACE)
59 ringtone = user_proxy.Get('com.ubuntu.touch.AccountsService.Sound', 'IncomingMessageSound',
60 dbus_interface=dbus.PROPERTIES_IFACE)
61
62 except dbus.exceptions.DBusException as e:
63 print("Couldn't get %s: %s" % (setting, e), file=sys.stderr)
64
65
66 self.assertTrue((ringtone in dconf_ringtone and notification in dconf_notification), "value does not sync between dconf and the one from DBus")
46 67

Subscribers

People subscribed via source and target branches

to all changes: