Merge lp:~alecu/ubuntuone-client/signature-dict into lp:ubuntuone-client

Proposed by Alejandro J. Cura on 2012-05-24
Status: Merged
Approved by: Manuel de la Peña on 2012-05-28
Approved revision: 1249
Merged at revision: 1249
Proposed branch: lp:~alecu/ubuntuone-client/signature-dict
Merge into: lp:ubuntuone-client
Diff against target: 79 lines (+34/-3)
2 files modified
tests/platform/credentials/test_linux.py (+26/-0)
ubuntuone/platform/credentials/linux.py (+8/-3)
To merge this branch: bzr merge lp:~alecu/ubuntuone-client/signature-dict
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve on 2012-05-28
dobey (community) 2012-05-24 Approve on 2012-05-25
Review via email: mp+107265@code.launchpad.net

Commit Message

- Use dbus.Dictionary to specify signature when using empty dicts for SSO calls. (LP: #711162)

To post a comment you must log in.
dobey (dobey) :
review: Approve
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/platform/credentials/test_linux.py'
2--- tests/platform/credentials/test_linux.py 2012-05-14 19:04:43 +0000
3+++ tests/platform/credentials/test_linux.py 2012-05-24 19:16:19 +0000
4@@ -402,6 +402,32 @@
5 self.assertEqual(self.sso_server._args, params)
6
7
8+class DictSignatureTestCase(DBusTestCase):
9+ """Test the errors with dict signatures."""
10+
11+ def verify(self, app_name, options_dict, reply_handler, error_handler):
12+ """Verify that the options_dict is a dbus.Dictionary."""
13+ self.assertIsInstance(options_dict, dbus.Dictionary)
14+
15+ def test_find_credentials_dict_signature(self):
16+ """Test for find_credentials."""
17+ creds_man = CredentialsManagement()
18+ self.patch(creds_man.sso_proxy, "find_credentials", self.verify)
19+ creds_man.find_credentials()
20+
21+ def test_find_credentials_sync_dict_signature(self):
22+ """Test for find_credentials_sync."""
23+ creds_man = CredentialsManagement()
24+ self.patch(creds_man.sso_proxy, "find_credentials_sync", self.verify)
25+ creds_man.find_credentials_sync()
26+
27+ def test_clear_credentials_dict_signature(self):
28+ """Test for clear_credentials."""
29+ creds_man = CredentialsManagement()
30+ self.patch(creds_man.sso_proxy, "clear_credentials", self.verify)
31+ creds_man.clear_credentials()
32+
33+
34 class SameAppNoErrorTestCase(CredentialsManagementTestCase):
35 """Test case when the app_name matches APP_NAME and there was no error."""
36
37
38=== modified file 'ubuntuone/platform/credentials/linux.py'
39--- ubuntuone/platform/credentials/linux.py 2012-04-09 20:07:05 +0000
40+++ ubuntuone/platform/credentials/linux.py 2012-05-24 19:16:19 +0000
41@@ -30,6 +30,7 @@
42 # files in the program, then also delete it here.
43 """Ubuntu One credentials management dbus service."""
44
45+import dbus
46 import dbus.service
47 import ubuntu_sso
48
49@@ -181,7 +182,8 @@
50 def find_credentials(self, reply_handler=NO_OP, error_handler=NO_OP):
51 """Ask the Ubuntu One credentials."""
52 self.ref_count += 1
53- self.sso_proxy.find_credentials(APP_NAME, {},
54+ self.sso_proxy.find_credentials(APP_NAME,
55+ dbus.Dictionary({}, signature='ss'),
56 reply_handler=reply_handler, error_handler=error_handler)
57
58 @dbus.service.method(dbus_interface=DBUS_CREDENTIALS_IFACE,
59@@ -205,7 +207,9 @@
60 self.ref_count -= 1
61
62 self.ref_count += 1
63- self.sso_proxy.find_credentials_sync(APP_NAME, {},
64+ self.sso_proxy.find_credentials_sync(
65+ APP_NAME,
66+ dbus.Dictionary({}, signature='ss'),
67 reply_handler=decrease_counter_success,
68 error_handler=decrease_counter_error)
69
70@@ -214,7 +218,8 @@
71 def clear_credentials(self, reply_handler=NO_OP, error_handler=NO_OP):
72 """Clear the Ubuntu One credentials."""
73 self.ref_count += 1
74- self.sso_proxy.clear_credentials(APP_NAME, {},
75+ self.sso_proxy.clear_credentials(APP_NAME,
76+ dbus.Dictionary({}, signature='ss'),
77 reply_handler=reply_handler, error_handler=error_handler)
78
79 @dbus.service.method(dbus_interface=DBUS_CREDENTIALS_IFACE,

Subscribers

People subscribed via source and target branches