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

Proposed by Manuel de la Peña
Status: Merged
Approved by: Manuel de la Peña
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
Shane Fagan (community) Approve
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.
Revision history for this message
Shane Fagan (shanepatrickfagan) wrote :

tested on windows trivial enough

review: Approve
Revision history for this message
Eric Casteleijn (thisfred) :
review: Approve
Revision history for this message
Eric Casteleijn (thisfred) wrote :

Although:

"""Test geting the credentials."""

should be:

"""Test getting the credentials."""

;)

694. By Manuel de la Peña

Fixed typo.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntu_sso/keyring/tests/test_windows.py'
--- ubuntu_sso/keyring/tests/test_windows.py 2011-03-18 09:30:20 +0000
+++ ubuntu_sso/keyring/tests/test_windows.py 2011-04-01 08:15:52 +0000
@@ -44,7 +44,7 @@
4444
45 @inlineCallbacks45 @inlineCallbacks
46 def test_get_credentials(self):46 def test_get_credentials(self):
47 """Test deleting the credentials."""47 """Test getting the credentials."""
48 app_name = 'name'48 app_name = 'name'
49 password = dict(password='password')49 password = dict(password='password')
50 self.keyring_lib.get_password(app_name, USERNAME)50 self.keyring_lib.get_password(app_name, USERNAME)
@@ -54,6 +54,16 @@
54 self.assertEqual(password, result)54 self.assertEqual(password, result)
5555
56 @inlineCallbacks56 @inlineCallbacks
57 def test_get_credentials_not_present(self):
58 """Test getting creds that are not present."""
59 app_name = 'name'
60 self.keyring_lib.get_password(app_name, USERNAME)
61 self.mocker.result(None)
62 self.mocker.replay()
63 result = yield self.keyring.get_credentials(app_name)
64 self.assertEqual(None, result)
65
66 @inlineCallbacks
57 def test_delete_credentials(self):67 def test_delete_credentials(self):
58 """Test deleting the credentials."""68 """Test deleting the credentials."""
59 app_name = 'name'69 app_name = 'name'
6070
=== modified file 'ubuntu_sso/keyring/windows.py'
--- ubuntu_sso/keyring/windows.py 2011-03-09 20:05:41 +0000
+++ ubuntu_sso/keyring/windows.py 2011-04-01 08:15:52 +0000
@@ -44,7 +44,8 @@
44 def _get_credentials_obj(self, app_name):44 def _get_credentials_obj(self, app_name):
45 """A dict with the credentials."""45 """A dict with the credentials."""
46 creds = self.keyring.get_password(app_name, USERNAME)46 creds = self.keyring.get_password(app_name, USERNAME)
47 return loads(creds)47 if creds:
48 return loads(creds)
4849
49 def get_credentials(self, app_name):50 def get_credentials(self, app_name):
50 """A deferred with the secret of the SSO item in a dictionary."""51 """A deferred with the secret of the SSO item in a dictionary."""

Subscribers

People subscribed via source and target branches