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
1=== modified file 'tests/api/test_custom_sound.py'
2--- tests/api/test_custom_sound.py 2014-08-11 09:46:56 +0000
3+++ tests/api/test_custom_sound.py 2014-08-13 03:15:14 +0000
4@@ -1,5 +1,6 @@
5 from autopilot.testcase import AutopilotTestCase
6 import os
7+import dbus
8 from gi.repository import Gio
9
10 #: Custom Ringtones/Notifications
11@@ -36,11 +37,31 @@
12
13 def test_custom_sounds_running(self):
14 """
15- This test ensures that the custom ringtone and notification have been set as default
16- sounds
17+ This test ensures that the custom ringtone and notification which set in dconf database
18+ have been synced picked by AccountsService dbus object.
19 """
20 settings = Gio.Settings('com.ubuntu.touch.sound')
21- default_ringtone = settings.get_string('incoming-call-sound')
22- default_notification = settings.get_string('incoming-message-sound')
23- self.assertTrue(ringtone in default_ringtone,notification in default_notification)
24+ dconf_ringtone = settings.get_string('incoming-call-sound')
25+ dconf_notification = settings.get_string('incoming-message-sound')
26+
27+ # get the setting in dbus object.
28+ system_bus = dbus.SystemBus()
29+ manager_proxy = system_bus.get_object('org.freedesktop.Accounts',
30+ '/org/freedesktop/Accounts')
31+ object_path = manager_proxy.FindUserById(
32+ os.getuid(), dbus_interface='org.freedesktop.Accounts'
33+ )
34+ user_proxy = system_bus.get_object('org.freedesktop.Accounts', object_path)
35+
36+ try:
37+ notification = user_proxy.Get('com.ubuntu.touch.AccountsService.Sound', 'IncomingCallSound',
38+ dbus_interface=dbus.PROPERTIES_IFACE)
39+ ringtone = user_proxy.Get('com.ubuntu.touch.AccountsService.Sound', 'IncomingMessageSound',
40+ dbus_interface=dbus.PROPERTIES_IFACE)
41+
42+ except dbus.exceptions.DBusException as e:
43+ print("Couldn't get %s: %s" % (setting, e), file=sys.stderr)
44+
45+
46+ self.assertTrue((ringtone in dconf_ringtone and notification in dconf_notification), "value does not sync between dconf and the one from DBus")
47

Subscribers

People subscribed via source and target branches

to all changes: