Merge lp:~mandel/ubuntu-sso-client/fix_no_creds_windows into lp:ubuntu-sso-client

Proposed by Manuel de la Peña on 2011-03-30
Status: Merged
Approved by: Manuel de la Peña on 2011-04-01
Approved revision: 694
Merged at revision: 694
Proposed branch: lp:~mandel/ubuntu-sso-client/fix_no_creds_windows
Merge into: lp:ubuntu-sso-client
Diff against target: 43 lines (+13/-2)
2 files modified
ubuntu_sso/keyring/tests/test_windows.py (+11/-1)
ubuntu_sso/keyring/windows.py (+2/-1)
To merge this branch: bzr merge lp:~mandel/ubuntu-sso-client/fix_no_creds_windows
Reviewer Review Type Date Requested Status
Eric Casteleijn (community) Approve on 2011-03-31
Shane Fagan (community) 2011-03-30 Approve on 2011-03-31
Review via email: mp+55651@code.launchpad.net

Commit message

Fixes lp:746096 the bug by ensuring that we do not try to load a json object from None.

Description of the change

Fixes lp:746096 the bug by ensuring that we do not try to load a json object from None.

To post a comment you must log in.
Shane Fagan (shanepatrickfagan) wrote :

tested on windows trivial enough

review: Approve
Eric Casteleijn (thisfred) :
review: Approve
Eric Casteleijn (thisfred) wrote :

Although:

"""Test geting the credentials."""

should be:

"""Test getting the credentials."""

;)

694. By Manuel de la Peña on 2011-04-01

Fixed typo.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/keyring/tests/test_windows.py'
2--- ubuntu_sso/keyring/tests/test_windows.py 2011-03-18 09:30:20 +0000
3+++ ubuntu_sso/keyring/tests/test_windows.py 2011-04-01 08:15:52 +0000
4@@ -44,7 +44,7 @@
5
6 @inlineCallbacks
7 def test_get_credentials(self):
8- """Test deleting the credentials."""
9+ """Test getting the credentials."""
10 app_name = 'name'
11 password = dict(password='password')
12 self.keyring_lib.get_password(app_name, USERNAME)
13@@ -54,6 +54,16 @@
14 self.assertEqual(password, result)
15
16 @inlineCallbacks
17+ def test_get_credentials_not_present(self):
18+ """Test getting creds that are not present."""
19+ app_name = 'name'
20+ self.keyring_lib.get_password(app_name, USERNAME)
21+ self.mocker.result(None)
22+ self.mocker.replay()
23+ result = yield self.keyring.get_credentials(app_name)
24+ self.assertEqual(None, result)
25+
26+ @inlineCallbacks
27 def test_delete_credentials(self):
28 """Test deleting the credentials."""
29 app_name = 'name'
30
31=== modified file 'ubuntu_sso/keyring/windows.py'
32--- ubuntu_sso/keyring/windows.py 2011-03-09 20:05:41 +0000
33+++ ubuntu_sso/keyring/windows.py 2011-04-01 08:15:52 +0000
34@@ -44,7 +44,8 @@
35 def _get_credentials_obj(self, app_name):
36 """A dict with the credentials."""
37 creds = self.keyring.get_password(app_name, USERNAME)
38- return loads(creds)
39+ if creds:
40+ return loads(creds)
41
42 def get_credentials(self, app_name):
43 """A deferred with the secret of the SSO item in a dictionary."""

Subscribers

People subscribed via source and target branches