Merge lp:~nataliabidart/ubuntuone-control-panel/offline-experience into lp:ubuntuone-control-panel

Proposed by Natalia Bidart
Status: Merged
Approved by: dobey
Approved revision: 92
Merged at revision: 91
Proposed branch: lp:~nataliabidart/ubuntuone-control-panel/offline-experience
Merge into: lp:ubuntuone-control-panel
Diff against target: 195 lines (+48/-23)
4 files modified
data/overview.ui (+2/-0)
ubuntuone/controlpanel/gtk/gui.py (+16/-12)
ubuntuone/controlpanel/gtk/tests/test_gui.py (+27/-7)
ubuntuone/controlpanel/gtk/tests/test_gui_basic.py (+3/-4)
To merge this branch: bzr merge lp:~nataliabidart/ubuntuone-control-panel/offline-experience
Reviewer Review Type Date Requested Status
Martin Albisetti (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+52110@code.launchpad.net

Commit message

- If network connection is UNKNOWN, assume that there is an internet connection (LP: #720990).
- Replaced in Account tab 'Value could not be retrieved' by a better legend (LP: #720990).

Description of the change

To test, you should start the UI having network, and not having network.

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1 as discussed on IRC

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

The attempt to merge lp:~nataliabidart/ubuntuone-control-panel/offline-experience into lp:ubuntuone-control-panel failed. Below is the output from the failed tests.

Running test suite for ubuntuone/controlpanel/tests
Xlib: extension "RANDR" missing on display ":99".
ubuntuone.controlpanel.tests.test_backend
  BackendAccountTestCase
    test_account_info ... [OK]
    test_account_info_fails ... [OK]
    test_account_info_with_current_plan ... [OK]
    test_backend_creation ... [OK]
    test_device_is_local ... [OK]
    test_get_token ... [OK]
  BackendBasicTestCase
    test_backend_creation ... [OK]
    test_device_is_local ... [OK]
    test_get_token ... [OK]
  BackendDevicesTestCase
    test_backend_creation ... [OK]
    test_change_download_speed_limit ... [OK]
    test_change_limit_bandwidth ... [OK]
    test_change_show_all_notifications ... [OK]
    test_change_upload_speed_limit ... [OK]
    test_changing_settings_for_wrong_id_has_no_effect ... [OK]
    test_device_is_local ... [OK]
    test_devices_info ... [OK]
    test_devices_info_fails ... [OK]
    test_get_token ... [OK]
    test_remove_device ... [OK]
    test_remove_device_clear_credentials_if_local_device ... [OK]
    test_remove_device_fails ... [OK]
  BackendFileSyncOpsTestCase
    test_backend_creation ... [OK]
    test_connect_files ... [OK]
    test_device_is_local ... [OK]
    test_disable_files ... [OK]
    test_disconnect_files ... [OK]
    test_enable_files ... [OK]
    test_get_token ... [OK]
    test_restart_files ... [OK]
    test_start_files ... [OK]
    test_stop_files ... [OK]
  BackendReplicationsTestCase
    test_backend_creation ... [OK]
    test_change_replication_settings ... [OK]
    test_change_replication_settings_...

Read more...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/overview.ui'
2--- data/overview.ui 2011-02-11 20:06:35 +0000
3+++ data/overview.ui 2011-03-03 18:39:06 +0000
4@@ -181,7 +181,9 @@
5 <property name="visible">True</property>
6 <property name="can_focus">False</property>
7 <property name="label">A warning label that can be long. Possible really long, let's see how it behaves.</property>
8+ <property name="use_markup">True</property>
9 <property name="wrap">True</property>
10+ <property name="width_chars">30</property>
11 </object>
12 <packing>
13 <property name="expand">False</property>
14
15=== modified file 'ubuntuone/controlpanel/gtk/gui.py'
16--- ubuntuone/controlpanel/gtk/gui.py 2011-03-03 03:18:14 +0000
17+++ ubuntuone/controlpanel/gtk/gui.py 2011-03-03 18:39:06 +0000
18@@ -213,9 +213,6 @@
19 AUTHORIZATION_DENIED = _('The authentication was cancelled.')
20 NETWORK_OFFLINE = _('An internet connection is required to join or sign '
21 'in to %(app_name)s.')
22- NETWORK_UNKNOWN = _('The internet connection state couldn\'t be '
23- 'discovered. Maybe NetworkManager is not running?')
24-
25 CONNECT = _('Connect to Ubuntu One')
26
27 def __init__(self, main_window):
28@@ -330,18 +327,14 @@
29 @log_call(logger.info)
30 def on_network_state_changed(self, state):
31 """Network state is reported."""
32- msg = None
33+ msg = ''
34 if state is networkstate.OFFLINE:
35 msg = self.NETWORK_OFFLINE % {'app_name': U1_APP_NAME}
36- elif state is networkstate.UNKNOWN:
37- msg = self.NETWORK_UNKNOWN
38-
39- if msg is not None:
40 self.set_sensitive(False)
41 self._set_warning(msg)
42 else:
43 self.set_sensitive(True)
44- self.warning_label.set_text('')
45+ self.warning_label.set_text(msg)
46 self.sso_backend.find_credentials(U1_APP_NAME, {},
47 reply_handler=NO_OP, error_handler=error_handler)
48
49@@ -350,6 +343,8 @@
50 """The dashboard panel. The user can manage the subscription."""
51
52 TITLE = _('Welcome to Ubuntu One!')
53+ VALUE_ERROR = _('The information could not be retrieved. '
54+ 'Maybe your internet connection is down?')
55
56 def __init__(self, main_window=None):
57 UbuntuOneBin.__init__(self)
58@@ -380,7 +375,7 @@
59 @log_call(logger.error)
60 def on_account_info_error(self, error_dict=None):
61 """Backend notifies of an error when fetching account info."""
62- self.on_error()
63+ self.on_error(message=self.VALUE_ERROR)
64 self.is_processing = False
65
66
67@@ -1278,7 +1273,11 @@
68 @log_call(logger.error)
69 def on_file_sync_status_error(self, error_dict=None):
70 """Backend notifies of an error when fetching file sync status."""
71- self._update_status(WARNING_MARKUP % self.FILE_SYNC_ERROR,
72+ msg = self.FILE_SYNC_ERROR
73+ reason = error_dict.get('error_msg', '') if error_dict else ''
74+ if reason:
75+ msg += ' (' + reason + ')'
76+ self._update_status(WARNING_MARKUP % msg,
77 self.RESTART, self.on_restart_clicked,
78 tooltip=self.RESTART_TOOLTIP)
79
80@@ -1414,6 +1413,11 @@
81 self.quota_label.set_markup(msg)
82 self.quota_label.stop()
83
84+ if fraction == 0.0:
85+ self.quota_progressbar.set_sensitive(False)
86+ else:
87+ self.quota_progressbar.set_sensitive(True)
88+
89 self.quota_progressbar.set_fraction(min(fraction, 1))
90
91 def load(self):
92@@ -1433,7 +1437,7 @@
93 @log_call(logger.error)
94 def on_account_info_error(self, error_dict=None):
95 """Backend notifies of an error when fetching account info."""
96- self._update_quota(WARNING_MARKUP % VALUE_ERROR)
97+ self._update_quota(msg='')
98
99
100 class ControlPanel(gtk.Notebook):
101
102=== modified file 'ubuntuone/controlpanel/gtk/tests/test_gui.py'
103--- ubuntuone/controlpanel/gtk/tests/test_gui.py 2011-03-03 03:18:14 +0000
104+++ ubuntuone/controlpanel/gtk/tests/test_gui.py 2011-03-03 18:39:06 +0000
105@@ -104,7 +104,7 @@
106 self.ui.on_account_info_error()
107
108 self.assertFalse(self.ui.account.get_visible())
109- self.assert_warning_correct(self.ui.message, gui.VALUE_ERROR)
110+ self.assert_warning_correct(self.ui.message, self.ui.VALUE_ERROR)
111
112
113 class VolumesTestCase(ControlPanelMixinTestCase):
114@@ -1574,7 +1574,8 @@
115 """
116 self.assertTrue(self.ui.label.get_visible())
117 self.assertFalse(self.ui.label.active)
118- self.assertTrue(self.ui.label.get_label().endswith(status))
119+ msg = '%r does not end with %r' % (self.ui.label.get_label(), status)
120+ self.assertTrue(self.ui.label.get_label().endswith(status), msg)
121
122 self.assertTrue(self.ui.button.is_sensitive())
123 self.assertFalse(self.ui.button.get_visited())
124@@ -1721,10 +1722,21 @@
125 action=self.ui.DISCONNECT,
126 tooltip=self.ui.DISCONNECT_TOOLTIP)
127
128- def test_on_file_sync_status_error(self):
129- """The file sync status couldn't be retrieved."""
130- self.patch(self.ui, 'on_restart_clicked', self._set_called)
131- self.ui.on_file_sync_status_error({'error_msg': 'error msg'})
132+ def test_on_file_sync_status_error_with_error_msg(self):
133+ """The file sync status couldn't be retrieved."""
134+ self.patch(self.ui, 'on_restart_clicked', self._set_called)
135+ msg = 'error message'
136+ self.ui.on_file_sync_status_error({'error_msg': msg})
137+
138+ msg = gui.WARNING_MARKUP % (self.ui.FILE_SYNC_ERROR + ' (' + msg + ')')
139+ self.assert_status_correct(msg,
140+ action=self.ui.RESTART,
141+ tooltip=self.ui.RESTART_TOOLTIP)
142+
143+ def test_on_file_sync_status_error_without_error_msg(self):
144+ """The file sync status couldn't be retrieved."""
145+ self.patch(self.ui, 'on_restart_clicked', self._set_called)
146+ self.ui.on_file_sync_status_error()
147
148 msg = gui.WARNING_MARKUP % self.ui.FILE_SYNC_ERROR
149 self.assert_status_correct(msg,
150@@ -1799,6 +1811,7 @@
151 progressbar_fraction = min(percentage / 100, 1)
152 self.assertEqual(self.ui.quota_progressbar.get_fraction(),
153 progressbar_fraction)
154+ self.assertTrue(self.ui.quota_progressbar.get_sensitive())
155
156 def test_is_a_vbox(self):
157 """Inherits from gtk.VBox."""
158@@ -1920,9 +1933,16 @@
159 def test_on_account_info_error(self):
160 """The account info couldn't be retrieved."""
161 self.ui.on_account_info_error()
162- self.assert_warning_correct(self.ui.quota_label, gui.VALUE_ERROR)
163+ self.assertEqual(self.ui.quota_label.get_text(), '')
164+ self.assertEqual(self.ui.quota_progressbar.get_fraction(), 0)
165+ self.assertFalse(self.ui.quota_progressbar.get_sensitive())
166 self.assertFalse(self.ui.quota_label.active)
167
168+ def test_on_account_info_error_after_success(self):
169+ """The account info couldn't be retrieved."""
170+ self.test_on_account_info_ready()
171+ self.test_on_account_info_error()
172+
173 def test_on_account_info_ready_quota_unused(self):
174 """The used quota is correct when unused."""
175 info = FAKE_ACCOUNT_INFO.copy()
176
177=== modified file 'ubuntuone/controlpanel/gtk/tests/test_gui_basic.py'
178--- ubuntuone/controlpanel/gtk/tests/test_gui_basic.py 2011-03-01 15:32:22 +0000
179+++ ubuntuone/controlpanel/gtk/tests/test_gui_basic.py 2011-03-03 18:39:06 +0000
180@@ -366,12 +366,11 @@
181 self.assertFalse(self.ui.get_sensitive())
182
183 def test_state_unknown(self):
184- """Network connection is unknown."""
185+ """Network connection is unknown. Assume that connection is present."""
186 self.ui.on_network_state_changed(gui.networkstate.UNKNOWN)
187
188- self.assert_warning_correct(self.ui.warning_label,
189- self.ui.NETWORK_UNKNOWN)
190- self.assertFalse(self.ui.get_sensitive())
191+ self.assertEqual(self.ui.warning_label.get_text(), '')
192+ self.assertTrue(self.ui.get_sensitive())
193
194
195 class OverwiewPanelOnlineTestCase(OverwiewPanelTestCase):

Subscribers

People subscribed via source and target branches