Merge lp:~diegosarmentero/ubuntuone-windows-installer/captcha-refresh into lp:ubuntuone-windows-installer

Proposed by Diego Sarmentero
Status: Merged
Approved by: Natalia Bidart
Approved revision: 78
Merged at revision: 74
Proposed branch: lp:~diegosarmentero/ubuntuone-windows-installer/captcha-refresh
Merge into: lp:ubuntuone-windows-installer
Diff against target: 251 lines (+53/-17)
9 files modified
ubuntuone_installer/gui/qt/gui.py (+2/-1)
ubuntuone_installer/gui/qt/main/tests/test_windows.py (+1/-1)
ubuntuone_installer/gui/qt/main/windows.py (+3/-1)
ubuntuone_installer/gui/qt/setup_account.py (+14/-0)
ubuntuone_installer/gui/qt/tests/test_gui.py (+4/-2)
ubuntuone_installer/gui/qt/tests/test_setup_account.py (+21/-0)
ubuntuone_installer/gui/qt/utils/__init__.py (+2/-2)
ubuntuone_installer/gui/qt/utils/tests/test_windows.py (+5/-9)
ubuntuone_installer/gui/qt/utils/windows.py (+1/-1)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-windows-installer/captcha-refresh
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+76622@code.launchpad.net

Commit message

- Fixed: There is no feedback on captcha loading/refreshing (LP: #852105).

Description of the change

- Fixed: There is no feedback on captcha loading/refreshing (LP: #852105).

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Lint issues:

ubuntuone_installer/gui/qt/gui.py:
    88: [C0301] Line too long (88/79)

ubuntuone_installer/gui/qt/main/tests/test_windows.py:
    89: [W0621, CredsFailureMainTestCase.check_updates] Redefining name 'gui' from outer scope (line 24)

ubuntuone_installer/gui/qt/tests/test_gui.py:
    707: [C0301] Line too long (85/79)

review: Approve
74. By Diego Sarmentero

Fixed lint issues.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

I'm now getting all these PEP8 issues:

./ubuntuone_installer/gui/qt/main/windows.py:47:1: E302 expected 2 blank lines, found 1
./ubuntuone_installer/gui/qt/main/windows.py:87:1: E302 expected 2 blank lines, found 1
./ubuntuone_installer/gui/qt/main/windows.py:93:66: W291 trailing whitespace
./ubuntuone_installer/gui/qt/utils/__init__.py:39:56: W291 trailing whitespace
./ubuntuone_installer/gui/qt/utils/__init__.py:40:50: W291 trailing whitespace
./ubuntuone_installer/gui/qt/utils/windows.py:34:51: W291 trailing whitespace
./ubuntuone_installer/gui/qt/utils/tests/test_windows.py:250:1: W291 trailing whitespace
./ubuntuone_installer/gui/qt/utils/tests/test_windows.py:273:26: E231 missing whitespace after ':'
./ubuntuone_installer/gui/qt/utils/tests/test_windows.py:276:5: E303 too many blank lines (2)
./ubuntuone_installer/gui/qt/utils/tests/test_windows.py:280:63: W291 trailing whitespace
./ubuntuone_installer/gui/qt/utils/tests/test_windows.py:291:5: E303 too many blank lines (2)
./ubuntuone_installer/gui/qt/utils/tests/test_windows.py:296:72: W291 trailing whitespace
./ubuntuone_installer/gui/qt/utils/tests/test_windows.py:316:1: W391 blank line at end of file

Seems like last week several errors were added to the repo.

review: Needs Fixing
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Can you please add those, even those are not added by your branch?

Thanks!

Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

> Can you please add those, even those are not added by your branch?
>
> Thanks!

Yes, no problem!

75. By Diego Sarmentero

Fixed PEP8 issues.

76. By Diego Sarmentero

Added bug number.

77. By Diego Sarmentero

Fixed PEP8 issues.

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

One thing to fix:

10:30:55 AM) nessita: gatox: and what I see is that as soon as I open the installer, the overlay is shown, even if I did not click on register
(10:31:18 AM) nessita: gatox: that should not be there: the loading overlay shoul only be shown in the register screen (when loading captcha)
(10:31:41 AM) ralsina: that's because we are loading the captcha in __init__
(10:31:47 AM) ralsina: and we should load it in initializePage
(10:31:57 AM) ralsina: that's a sso fix

(10:32:19 AM) nessita: gatox: open the installer with your captcha branch, having the sso captcha branch in the PYTHONPATH
(10:32:34 AM) nessita: gatox: you will get the overlay in the first screen of the installer

review: Needs Fixing
78. By Diego Sarmentero

Fixed overlay to only show if the captcha has not been received and the user reach the setup account page.

Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntuone_installer/gui/qt/gui.py'
--- ubuntuone_installer/gui/qt/gui.py 2011-09-22 19:05:56 +0000
+++ ubuntuone_installer/gui/qt/gui.py 2011-09-28 17:34:23 +0000
@@ -85,7 +85,8 @@
85SKIP_TOUR = _("Skip tour, go to Dashboard")85SKIP_TOUR = _("Skip tour, go to Dashboard")
86START_SETUP = _("Start setup")86START_SETUP = _("Start setup")
87UPDATE_TITLE = _("Updates are available")87UPDATE_TITLE = _("Updates are available")
88UPDATE_SOFTWARE = _("There is a new version available. Do you want perform an upgrade?")88UPDATE_SOFTWARE = _("There is a new version available. "
89 "Do you want perform an upgrade?")
89# Invalid name logger90# Invalid name logger
90# pylint: disable=C010391# pylint: disable=C0103
91logger = setup_logging('qt.gui')92logger = setup_logging('qt.gui')
9293
=== modified file 'ubuntuone_installer/gui/qt/main/tests/test_windows.py'
--- ubuntuone_installer/gui/qt/main/tests/test_windows.py 2011-09-22 19:05:56 +0000
+++ ubuntuone_installer/gui/qt/main/tests/test_windows.py 2011-09-28 17:34:23 +0000
@@ -86,7 +86,7 @@
86 """A fake stop."""86 """A fake stop."""
87 self.stopped = True87 self.stopped = True
8888
89 def check_updates(self, gui, logger):89 def check_updates(self, gui_ref, logger):
90 """A fake check updates."""90 """A fake check updates."""
91 self.updates_checked = True91 self.updates_checked = True
9292
9393
=== modified file 'ubuntuone_installer/gui/qt/main/windows.py'
--- ubuntuone_installer/gui/qt/main/windows.py 2011-09-22 19:40:28 +0000
+++ ubuntuone_installer/gui/qt/main/windows.py 2011-09-28 17:34:23 +0000
@@ -44,6 +44,7 @@
44 'Error while getting the credentials: %r', exc)44 'Error while getting the credentials: %r', exc)
45 stop()45 stop()
4646
47
47@defer.inlineCallbacks48@defer.inlineCallbacks
48def success_cb(creds, gui, installing, logger):49def success_cb(creds, gui, installing, logger):
49 """Handle credentials success."""50 """Handle credentials success."""
@@ -84,13 +85,14 @@
84 else:85 else:
85 yield success_cb(creds, gui, installer, logger)86 yield success_cb(creds, gui, installer, logger)
8687
88
87@defer.inlineCallbacks89@defer.inlineCallbacks
88def check_updates(gui, logger):90def check_updates(gui, logger):
89 """Check for updates."""91 """Check for updates."""
90 logger.info('Checking for updates.')92 logger.info('Checking for updates.')
91 # the idea is simple, check if there are updates, ask user if we perform93 # the idea is simple, check if there are updates, ask user if we perform
92 # the update and continue.94 # the update and continue.
93 are_updates_present = yield utils.are_updates_present(logger) 95 are_updates_present = yield utils.are_updates_present(logger)
94 logger.debug('Updates present: %r', are_updates_present)96 logger.debug('Updates present: %r', are_updates_present)
95 if are_updates_present:97 if are_updates_present:
96 logger.info('Updates are present.')98 logger.info('Updates are present.')
9799
=== modified file 'ubuntuone_installer/gui/qt/setup_account.py'
--- ubuntuone_installer/gui/qt/setup_account.py 2011-09-16 18:01:37 +0000
+++ ubuntuone_installer/gui/qt/setup_account.py 2011-09-28 17:34:23 +0000
@@ -70,6 +70,7 @@
70 self.ui.hlayout_check.addWidget(self.terms_checkbox)70 self.ui.hlayout_check.addWidget(self.terms_checkbox)
7171
72 self.set_up_button = None72 self.set_up_button = None
73 self.captcha_received = False
7374
74 # Invalid name "initializePage"75 # Invalid name "initializePage"
75 # pylint: disable=C010376 # pylint: disable=C0103
@@ -183,6 +184,8 @@
183 QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"),184 QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"),
184 self.focus_changed)185 self.focus_changed)
185 super(SetupAccountPage, self).showEvent(event)186 super(SetupAccountPage, self).showEvent(event)
187 if not self.captcha_received:
188 self.wizard().overlay.show()
186189
187 def hideEvent(self, event):190 def hideEvent(self, event):
188 """Disconnect the focusChanged signal when the page change."""191 """Disconnect the focusChanged signal when the page change."""
@@ -196,6 +199,17 @@
196 pass199 pass
197 super(SetupAccountPage, self).hideEvent(event)200 super(SetupAccountPage, self).hideEvent(event)
198201
202 def on_captcha_refreshing(self):
203 """Show overlay when captcha is refreshing."""
204 if self.isVisible():
205 self.wizard().overlay.show()
206 self.captcha_received = False
207
208 def on_captcha_refresh_complete(self):
209 """Hide overlay when captcha finished refreshing."""
210 self.wizard().overlay.hide()
211 self.captcha_received = True
212
199213
200def is_min_required_password(password):214def is_min_required_password(password):
201 """Return if the password meets the minimum requirements."""215 """Return if the password meets the minimum requirements."""
202216
=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-22 19:05:56 +0000
+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-28 17:34:23 +0000
@@ -664,6 +664,7 @@
664 QtGui.QWizard.FinishButton,664 QtGui.QWizard.FinishButton,
665 QtGui.QWizard.NextButton])665 QtGui.QWizard.NextButton])
666666
667
667class UpgradeQuestion(BaseTestCase):668class UpgradeQuestion(BaseTestCase):
668 """Test the dialog that ask the user if he wants to upgrade."""669 """Test the dialog that ask the user if he wants to upgrade."""
669670
@@ -672,7 +673,7 @@
672 """Set the tests."""673 """Set the tests."""
673 yield super(UpgradeQuestion, self).setUp()674 yield super(UpgradeQuestion, self).setUp()
674 self.answer = 0675 self.answer = 0
675 self.parent = None 676 self.parent = None
676 self.title = None677 self.title = None
677 self.text = None678 self.text = None
678 self.yes_button = None679 self.yes_button = None
@@ -704,7 +705,8 @@
704 def user_wants_to_update_false(self):705 def user_wants_to_update_false(self):
705 """Test the question."""706 """Test the question."""
706 self.answer = gui.QtGui.QMessageBox.No707 self.answer = gui.QtGui.QMessageBox.No
707 self.assertFalse(gui.user_wants_to_update(), 'User DOES NOT want to update.')708 self.assertFalse(gui.user_wants_to_update(),
709 'User DOES NOT want to update.')
708 # lets assert the parameters710 # lets assert the parameters
709 self.assertTrue(None, self.parent)711 self.assertTrue(None, self.parent)
710 self.assertTrue(self.title, gui.UPDATE_TITLE)712 self.assertTrue(self.title, gui.UPDATE_TITLE)
711713
=== modified file 'ubuntuone_installer/gui/qt/tests/test_setup_account.py'
--- ubuntuone_installer/gui/qt/tests/test_setup_account.py 2011-09-19 15:41:40 +0000
+++ ubuntuone_installer/gui/qt/tests/test_setup_account.py 2011-09-28 17:34:23 +0000
@@ -165,6 +165,8 @@
165 self.ui.set_up_button)165 self.ui.set_up_button)
166 self.assertFalse(self.ui.set_up_button.isEnabled())166 self.assertFalse(self.ui.set_up_button.isEnabled())
167167
168 self.assertFalse(self.ui.captcha_received)
169
168 # labels170 # labels
169 self.assertEqual(self.ui.ui.name_label.text(), gui.NAME)171 self.assertEqual(self.ui.ui.name_label.text(), gui.NAME)
170 self.assertEqual(self.ui.ui.email_label.text(), gui.EMAIL)172 self.assertEqual(self.ui.ui.email_label.text(), gui.EMAIL)
@@ -187,6 +189,7 @@
187 """Validation and overlay is shown when the setupbutton is clicked."""189 """Validation and overlay is shown when the setupbutton is clicked."""
188 self.patch(self.ui.controller, 'set_next_validation', self._set_called)190 self.patch(self.ui.controller, 'set_next_validation', self._set_called)
189 self.ui.initializePage()191 self.ui.initializePage()
192 self.ui.captcha_received = True
190 self.ui.show()193 self.ui.show()
191 self.addCleanup(self.ui.hide)194 self.addCleanup(self.ui.hide)
192195
@@ -307,3 +310,21 @@
307 """Check that show_event works when set_up_button is none."""310 """Check that show_event works when set_up_button is none."""
308 self.assertEqual(self.ui.set_up_button, None)311 self.assertEqual(self.ui.set_up_button, None)
309 self.ui.showEvent(QtGui.QShowEvent())312 self.ui.showEvent(QtGui.QShowEvent())
313
314 def test_on_captcha_refreshing(self):
315 """Check the state of the overlay on captcha refreshing."""
316 self.assertEqual(self.ui.wizard().overlay.show_counter, 0)
317 self.ui.on_captcha_refreshing()
318 self.assertEqual(self.ui.wizard().overlay.show_counter, 0)
319 self.ui.captcha_received = True
320 self.ui.show()
321 self.addCleanup(self.ui.hide)
322 self.assertEqual(self.ui.wizard().overlay.show_counter, 0)
323 self.ui.on_captcha_refreshing()
324 self.assertEqual(self.ui.wizard().overlay.show_counter, 1)
325
326 def test_on_captcha_refresh_complete(self):
327 """Check the state of the overlay on captcha refreshing complete."""
328 self.assertEqual(self.ui.wizard().overlay.hide_counter, 0)
329 self.ui.on_captcha_refresh_complete()
330 self.assertEqual(self.ui.wizard().overlay.hide_counter, 1)
310331
=== modified file 'ubuntuone_installer/gui/qt/utils/__init__.py'
--- ubuntuone_installer/gui/qt/utils/__init__.py 2011-09-19 15:14:38 +0000
+++ ubuntuone_installer/gui/qt/utils/__init__.py 2011-09-28 17:34:23 +0000
@@ -36,5 +36,5 @@
36 start_control_panel = linux.start_control_panel36 start_control_panel = linux.start_control_panel
37 add_syncdaemon_to_autostart = linux.add_syncdaemon_to_autostart37 add_syncdaemon_to_autostart = linux.add_syncdaemon_to_autostart
38 default_folders = linux.default_folders38 default_folders = linux.default_folders
39 are_updates_present = lambda *args, **kwargs: False 39 are_updates_present = lambda *args, **kwargs: False
40 perform_update = lambda *args, **kwargs: None 40 perform_update = lambda *args, **kwargs: None
4141
=== modified file 'ubuntuone_installer/gui/qt/utils/tests/test_windows.py'
--- ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-09-22 19:40:28 +0000
+++ ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-09-28 17:34:23 +0000
@@ -196,7 +196,7 @@
196 self.assertEqual(self.registry.set_args,196 self.assertEqual(self.registry.set_args,
197 [(('KEY', 'Ubuntu One', 0, 1,197 [(('KEY', 'Ubuntu One', 0, 1,
198 'C:\\Python27\\ubuntuone-syncdaemon.exe'), {}),198 'C:\\Python27\\ubuntuone-syncdaemon.exe'), {}),
199 (('KEY', 'Ubuntu One Icon', 0, 1,199 (('KEY', 'Ubuntu One Icon', 0, 1,
200 'C:\\Python27\\ubuntuone-control-panel-qt.exe --minimized'),200 'C:\\Python27\\ubuntuone-control-panel-qt.exe --minimized'),
201 {})])201 {})])
202202
@@ -247,7 +247,7 @@
247 def debug(self, message, *args, **kwargs):247 def debug(self, message, *args, **kwargs):
248 """Set a debug log message."""248 """Set a debug log message."""
249 self.called_methods.append(('debug', message, args, kwargs))249 self.called_methods.append(('debug', message, args, kwargs))
250 250
251251
252class AutoupdaterTestCase(BaseTestCase):252class AutoupdaterTestCase(BaseTestCase):
253 """Test the code that is used for the auto update process."""253 """Test the code that is used for the auto update process."""
@@ -270,14 +270,13 @@
270 self.fake_logger = FakeLogger()270 self.fake_logger = FakeLogger()
271 self.patch(utils.windows, 'getProcessValue', fake_execute_process)271 self.patch(utils.windows, 'getProcessValue', fake_execute_process)
272 self.patch(utils.windows, '_get_update_path',272 self.patch(utils.windows, '_get_update_path',
273 lambda:self.auto_update_path)273 lambda: self.auto_update_path)
274
275274
276 @defer.inlineCallbacks275 @defer.inlineCallbacks
277 def test_are_updates_present_true(self):276 def test_are_updates_present_true(self):
278 """Test when updates are present."""277 """Test when updates are present."""
279 # the idea is simple, set the value to be returned from278 # the idea is simple, set the value to be returned from
280 # the fake call, assert that we get true and also that 279 # the fake call, assert that we get true and also that
281 # we did use the correct parameters.280 # we did use the correct parameters.
282 self.return_from_call = 0281 self.return_from_call = 0
283 are_present = yield utils.are_updates_present(self.fake_logger)282 are_present = yield utils.are_updates_present(self.fake_logger)
@@ -287,13 +286,12 @@
287 self.assertEqual(expected_args, self.args)286 self.assertEqual(expected_args, self.args)
288 self.assertEqual(self.command, self.auto_update_path)287 self.assertEqual(self.command, self.auto_update_path)
289288
290
291 @defer.inlineCallbacks289 @defer.inlineCallbacks
292 def test_are_updates_present_false(self):290 def test_are_updates_present_false(self):
293 """Test when updates are not present."""291 """Test when updates are not present."""
294 # similar to test_are_updates_present_true but with diff retcode292 # similar to test_are_updates_present_true but with diff retcode
295 self.return_from_call = 40293 self.return_from_call = 40
296 are_present = yield utils.are_updates_present(self.fake_logger) 294 are_present = yield utils.are_updates_present(self.fake_logger)
297 self.assertFalse(are_present, 'Updates should NOT be present.')295 self.assertFalse(are_present, 'Updates should NOT be present.')
298 # lets assert that we did use the correct args296 # lets assert that we did use the correct args
299 expected_args = ('--mode', 'unattended')297 expected_args = ('--mode', 'unattended')
@@ -312,5 +310,3 @@
312310
313 def test_get_auto_update_path(self):311 def test_get_auto_update_path(self):
314 """Test the method used to get the autoupdate."""312 """Test the method used to get the autoupdate."""
315
316
317313
=== modified file 'ubuntuone_installer/gui/qt/utils/windows.py'
--- ubuntuone_installer/gui/qt/utils/windows.py 2011-09-22 19:40:28 +0000
+++ ubuntuone_installer/gui/qt/utils/windows.py 2011-09-28 17:34:23 +0000
@@ -31,7 +31,7 @@
31# pylint: enable=F040131# pylint: enable=F0401
3232
33from twisted.internet import defer33from twisted.internet import defer
34from twisted.internet.utils import getProcessValue 34from twisted.internet.utils import getProcessValue
3535
36AUTORUN_KEY = r"Software\Microsoft\Windows\CurrentVersion\Run"36AUTORUN_KEY = r"Software\Microsoft\Windows\CurrentVersion\Run"
3737

Subscribers

People subscribed via source and target branches