Merge lp:~ralsina/ubuntuone-control-panel/decrypt-errors-3-0 into lp:ubuntuone-control-panel/stable-3-0

Proposed by Roberto Alsina
Status: Merged
Approved by: dobey
Approved revision: 264
Merged at revision: 264
Proposed branch: lp:~ralsina/ubuntuone-control-panel/decrypt-errors-3-0
Merge into: lp:ubuntuone-control-panel/stable-3-0
Diff against target: 59 lines (+21/-0)
3 files modified
ubuntuone/controlpanel/backend.py (+7/-0)
ubuntuone/controlpanel/gui/qt/ubuntuonebin.py (+5/-0)
ubuntuone/controlpanel/tests/test_backend.py (+9/-0)
To merge this branch: bzr merge lp:~ralsina/ubuntuone-control-panel/decrypt-errors-3-0
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
dobey (community) Approve
Review via email: mp+107671@code.launchpad.net

Commit message

 - Hides cryptic error (Fixes LP:1002377).

Description of the change

Fixes something that only happens on windows, where a failure to start syncdaemon will cause sd_client to be None.

Proposing only for stable-3-0 because in trunk, with endpoints, this is not supposed to happen anymore, but we will still do future windows releases from 3-0

This should not have any effects on Ubuntu.

To post a comment you must log in.
Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Manuel de la Peña (mandel) wrote :

A little ugly but works and is not needed in trunk.

review: Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (68.3 KiB)

The attempt to merge lp:~ralsina/ubuntuone-control-panel/decrypt-errors-3-0 into lp:ubuntuone-control-panel/stable-3-0 failed. Below is the output from the failed tests.

*** Running test suite for ubuntuone/controlpanel ***
ubuntuone.controlpanel.tests.test_replication_client
  ReplicationsTestCase
    test_exclude ... [OK]
    test_exclude_name_in_exclusions ... [OK]
    test_exclude_name_not_in_replications ... [OK]
    test_get_exclusions ... [OK]
    test_get_replications ... [OK]
    test_no_pairing_record ... [OK]
    test_replicate ... [OK]
    test_replicate_name_not_in_exclusions ... [OK]
    test_replicate_name_not_in_replications ... [OK]
ubuntuone.controlpanel.tests
  TestCase
    runTest ... [OK]
ubuntuone.controlpanel.tests.test_backend
  BackendAccountTestCase
    test_account_info ... [OK]
    test_account_info_fails ... [OK]
    test_account_info_fails_with_unauthorized ... [OK]
    test_account_info_with_current_plan ... [OK]
    test_backend_creation ... [OK]
    test_device_is_local ... [OK]
    test_get_token ... [OK]
    test_login_client_is_cached ... [OK]
    test_sd_client_is_cached ... [OK]
    test_shutdown_func ... [OK]
    test_shutdown_func_is_called_on_shutdown ... [OK]
    test_shutdown_func_when_none ... [OK]
  BackendBasicTestCase
    test_backend_creation ... [OK]
    test_device_is_local ... [OK]
    test_get_token ... [OK]
    test_login_client_is_cached ... [OK]
    test_sd_client_is_cached ... [OK]
    test_shutdown_func ... [OK]
    test_shutdown_func_is_called_on_shutdown ... [OK]
    test_shutdown_func_when_none ... [OK]
  BackendCredentialsTestCase
    test_backend_creation ... [OK]
    test_clear_credentials ... [OK]
    test_clear_credentials_invalidates_cached_credentials ... [OK]
    test_credentials_are_cached ... [OK]
    test_device_is_l...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/controlpanel/backend.py'
2--- ubuntuone/controlpanel/backend.py 2012-05-18 16:49:05 +0000
3+++ ubuntuone/controlpanel/backend.py 2012-05-28 17:58:17 +0000
4@@ -106,6 +106,10 @@
5 return inner
6
7
8+class SyncDaemonException(Exception):
9+ """A problem instantiating SyncDaemonClient."""
10+
11+
12 class ControlBackend(object):
13 """The control panel backend."""
14
15@@ -135,6 +139,9 @@
16
17 self.login_client = CredentialsManagementTool()
18 self.sd_client = sd_client.SyncDaemonClient()
19+ if self.sd_client is None:
20+ # Probably syncdaemon is not starting
21+ raise SyncDaemonException("Error creating SyncDaemonClient.")
22 self.wc = WebClient(self.get_credentials)
23
24 logger.info('ControlBackend: instance started.')
25
26=== modified file 'ubuntuone/controlpanel/gui/qt/ubuntuonebin.py'
27--- ubuntuone/controlpanel/gui/qt/ubuntuonebin.py 2012-02-29 17:39:03 +0000
28+++ ubuntuone/controlpanel/gui/qt/ubuntuonebin.py 2012-05-28 17:58:17 +0000
29@@ -51,6 +51,11 @@
30 error_handler=self._error_handler)
31 self.load = handler(self.load)
32
33+ # Ensure we load the backend here, so it shows an error if needed
34+ # pylint: disable=W0104
35+ self.backend
36+ # pylint: enable=W0104
37+
38 self._setup()
39
40 def _get_is_processing(self):
41
42=== modified file 'ubuntuone/controlpanel/tests/test_backend.py'
43--- ubuntuone/controlpanel/tests/test_backend.py 2012-05-18 16:49:05 +0000
44+++ ubuntuone/controlpanel/tests/test_backend.py 2012-05-28 17:58:17 +0000
45@@ -361,6 +361,15 @@
46 raise ValueError(args)
47
48
49+class SDClientFailureTestCase(TestCase):
50+ """Test behaviour in class of sd_client instantiation failure."""
51+
52+ def test_sd_client_is_none(self):
53+ """A failing SyncDaemonClient should trigger exception."""
54+ self.patch(backend.sd_client, "SyncDaemonClient", lambda: None)
55+ self.assertRaises(backend.SyncDaemonException, backend.ControlBackend)
56+
57+
58 class BackendBasicTestCase(TestCase):
59 """Simple tests for the backend."""
60

Subscribers

People subscribed via source and target branches