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
1=== modified file 'ubuntuone_installer/gui/qt/gui.py'
2--- ubuntuone_installer/gui/qt/gui.py 2011-09-22 19:05:56 +0000
3+++ ubuntuone_installer/gui/qt/gui.py 2011-09-28 17:34:23 +0000
4@@ -85,7 +85,8 @@
5 SKIP_TOUR = _("Skip tour, go to Dashboard")
6 START_SETUP = _("Start setup")
7 UPDATE_TITLE = _("Updates are available")
8-UPDATE_SOFTWARE = _("There is a new version available. Do you want perform an upgrade?")
9+UPDATE_SOFTWARE = _("There is a new version available. "
10+ "Do you want perform an upgrade?")
11 # Invalid name logger
12 # pylint: disable=C0103
13 logger = setup_logging('qt.gui')
14
15=== modified file 'ubuntuone_installer/gui/qt/main/tests/test_windows.py'
16--- ubuntuone_installer/gui/qt/main/tests/test_windows.py 2011-09-22 19:05:56 +0000
17+++ ubuntuone_installer/gui/qt/main/tests/test_windows.py 2011-09-28 17:34:23 +0000
18@@ -86,7 +86,7 @@
19 """A fake stop."""
20 self.stopped = True
21
22- def check_updates(self, gui, logger):
23+ def check_updates(self, gui_ref, logger):
24 """A fake check updates."""
25 self.updates_checked = True
26
27
28=== modified file 'ubuntuone_installer/gui/qt/main/windows.py'
29--- ubuntuone_installer/gui/qt/main/windows.py 2011-09-22 19:40:28 +0000
30+++ ubuntuone_installer/gui/qt/main/windows.py 2011-09-28 17:34:23 +0000
31@@ -44,6 +44,7 @@
32 'Error while getting the credentials: %r', exc)
33 stop()
34
35+
36 @defer.inlineCallbacks
37 def success_cb(creds, gui, installing, logger):
38 """Handle credentials success."""
39@@ -84,13 +85,14 @@
40 else:
41 yield success_cb(creds, gui, installer, logger)
42
43+
44 @defer.inlineCallbacks
45 def check_updates(gui, logger):
46 """Check for updates."""
47 logger.info('Checking for updates.')
48 # the idea is simple, check if there are updates, ask user if we perform
49 # the update and continue.
50- are_updates_present = yield utils.are_updates_present(logger)
51+ are_updates_present = yield utils.are_updates_present(logger)
52 logger.debug('Updates present: %r', are_updates_present)
53 if are_updates_present:
54 logger.info('Updates are present.')
55
56=== modified file 'ubuntuone_installer/gui/qt/setup_account.py'
57--- ubuntuone_installer/gui/qt/setup_account.py 2011-09-16 18:01:37 +0000
58+++ ubuntuone_installer/gui/qt/setup_account.py 2011-09-28 17:34:23 +0000
59@@ -70,6 +70,7 @@
60 self.ui.hlayout_check.addWidget(self.terms_checkbox)
61
62 self.set_up_button = None
63+ self.captcha_received = False
64
65 # Invalid name "initializePage"
66 # pylint: disable=C0103
67@@ -183,6 +184,8 @@
68 QtCore.SIGNAL("focusChanged(QWidget*, QWidget*)"),
69 self.focus_changed)
70 super(SetupAccountPage, self).showEvent(event)
71+ if not self.captcha_received:
72+ self.wizard().overlay.show()
73
74 def hideEvent(self, event):
75 """Disconnect the focusChanged signal when the page change."""
76@@ -196,6 +199,17 @@
77 pass
78 super(SetupAccountPage, self).hideEvent(event)
79
80+ def on_captcha_refreshing(self):
81+ """Show overlay when captcha is refreshing."""
82+ if self.isVisible():
83+ self.wizard().overlay.show()
84+ self.captcha_received = False
85+
86+ def on_captcha_refresh_complete(self):
87+ """Hide overlay when captcha finished refreshing."""
88+ self.wizard().overlay.hide()
89+ self.captcha_received = True
90+
91
92 def is_min_required_password(password):
93 """Return if the password meets the minimum requirements."""
94
95=== modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py'
96--- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-22 19:05:56 +0000
97+++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-28 17:34:23 +0000
98@@ -664,6 +664,7 @@
99 QtGui.QWizard.FinishButton,
100 QtGui.QWizard.NextButton])
101
102+
103 class UpgradeQuestion(BaseTestCase):
104 """Test the dialog that ask the user if he wants to upgrade."""
105
106@@ -672,7 +673,7 @@
107 """Set the tests."""
108 yield super(UpgradeQuestion, self).setUp()
109 self.answer = 0
110- self.parent = None
111+ self.parent = None
112 self.title = None
113 self.text = None
114 self.yes_button = None
115@@ -704,7 +705,8 @@
116 def user_wants_to_update_false(self):
117 """Test the question."""
118 self.answer = gui.QtGui.QMessageBox.No
119- self.assertFalse(gui.user_wants_to_update(), 'User DOES NOT want to update.')
120+ self.assertFalse(gui.user_wants_to_update(),
121+ 'User DOES NOT want to update.')
122 # lets assert the parameters
123 self.assertTrue(None, self.parent)
124 self.assertTrue(self.title, gui.UPDATE_TITLE)
125
126=== modified file 'ubuntuone_installer/gui/qt/tests/test_setup_account.py'
127--- ubuntuone_installer/gui/qt/tests/test_setup_account.py 2011-09-19 15:41:40 +0000
128+++ ubuntuone_installer/gui/qt/tests/test_setup_account.py 2011-09-28 17:34:23 +0000
129@@ -165,6 +165,8 @@
130 self.ui.set_up_button)
131 self.assertFalse(self.ui.set_up_button.isEnabled())
132
133+ self.assertFalse(self.ui.captcha_received)
134+
135 # labels
136 self.assertEqual(self.ui.ui.name_label.text(), gui.NAME)
137 self.assertEqual(self.ui.ui.email_label.text(), gui.EMAIL)
138@@ -187,6 +189,7 @@
139 """Validation and overlay is shown when the setupbutton is clicked."""
140 self.patch(self.ui.controller, 'set_next_validation', self._set_called)
141 self.ui.initializePage()
142+ self.ui.captcha_received = True
143 self.ui.show()
144 self.addCleanup(self.ui.hide)
145
146@@ -307,3 +310,21 @@
147 """Check that show_event works when set_up_button is none."""
148 self.assertEqual(self.ui.set_up_button, None)
149 self.ui.showEvent(QtGui.QShowEvent())
150+
151+ def test_on_captcha_refreshing(self):
152+ """Check the state of the overlay on captcha refreshing."""
153+ self.assertEqual(self.ui.wizard().overlay.show_counter, 0)
154+ self.ui.on_captcha_refreshing()
155+ self.assertEqual(self.ui.wizard().overlay.show_counter, 0)
156+ self.ui.captcha_received = True
157+ self.ui.show()
158+ self.addCleanup(self.ui.hide)
159+ self.assertEqual(self.ui.wizard().overlay.show_counter, 0)
160+ self.ui.on_captcha_refreshing()
161+ self.assertEqual(self.ui.wizard().overlay.show_counter, 1)
162+
163+ def test_on_captcha_refresh_complete(self):
164+ """Check the state of the overlay on captcha refreshing complete."""
165+ self.assertEqual(self.ui.wizard().overlay.hide_counter, 0)
166+ self.ui.on_captcha_refresh_complete()
167+ self.assertEqual(self.ui.wizard().overlay.hide_counter, 1)
168
169=== modified file 'ubuntuone_installer/gui/qt/utils/__init__.py'
170--- ubuntuone_installer/gui/qt/utils/__init__.py 2011-09-19 15:14:38 +0000
171+++ ubuntuone_installer/gui/qt/utils/__init__.py 2011-09-28 17:34:23 +0000
172@@ -36,5 +36,5 @@
173 start_control_panel = linux.start_control_panel
174 add_syncdaemon_to_autostart = linux.add_syncdaemon_to_autostart
175 default_folders = linux.default_folders
176- are_updates_present = lambda *args, **kwargs: False
177- perform_update = lambda *args, **kwargs: None
178+ are_updates_present = lambda *args, **kwargs: False
179+ perform_update = lambda *args, **kwargs: None
180
181=== modified file 'ubuntuone_installer/gui/qt/utils/tests/test_windows.py'
182--- ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-09-22 19:40:28 +0000
183+++ ubuntuone_installer/gui/qt/utils/tests/test_windows.py 2011-09-28 17:34:23 +0000
184@@ -196,7 +196,7 @@
185 self.assertEqual(self.registry.set_args,
186 [(('KEY', 'Ubuntu One', 0, 1,
187 'C:\\Python27\\ubuntuone-syncdaemon.exe'), {}),
188- (('KEY', 'Ubuntu One Icon', 0, 1,
189+ (('KEY', 'Ubuntu One Icon', 0, 1,
190 'C:\\Python27\\ubuntuone-control-panel-qt.exe --minimized'),
191 {})])
192
193@@ -247,7 +247,7 @@
194 def debug(self, message, *args, **kwargs):
195 """Set a debug log message."""
196 self.called_methods.append(('debug', message, args, kwargs))
197-
198+
199
200 class AutoupdaterTestCase(BaseTestCase):
201 """Test the code that is used for the auto update process."""
202@@ -270,14 +270,13 @@
203 self.fake_logger = FakeLogger()
204 self.patch(utils.windows, 'getProcessValue', fake_execute_process)
205 self.patch(utils.windows, '_get_update_path',
206- lambda:self.auto_update_path)
207-
208+ lambda: self.auto_update_path)
209
210 @defer.inlineCallbacks
211 def test_are_updates_present_true(self):
212 """Test when updates are present."""
213 # the idea is simple, set the value to be returned from
214- # the fake call, assert that we get true and also that
215+ # the fake call, assert that we get true and also that
216 # we did use the correct parameters.
217 self.return_from_call = 0
218 are_present = yield utils.are_updates_present(self.fake_logger)
219@@ -287,13 +286,12 @@
220 self.assertEqual(expected_args, self.args)
221 self.assertEqual(self.command, self.auto_update_path)
222
223-
224 @defer.inlineCallbacks
225 def test_are_updates_present_false(self):
226 """Test when updates are not present."""
227 # similar to test_are_updates_present_true but with diff retcode
228 self.return_from_call = 40
229- are_present = yield utils.are_updates_present(self.fake_logger)
230+ are_present = yield utils.are_updates_present(self.fake_logger)
231 self.assertFalse(are_present, 'Updates should NOT be present.')
232 # lets assert that we did use the correct args
233 expected_args = ('--mode', 'unattended')
234@@ -312,5 +310,3 @@
235
236 def test_get_auto_update_path(self):
237 """Test the method used to get the autoupdate."""
238-
239-
240
241=== modified file 'ubuntuone_installer/gui/qt/utils/windows.py'
242--- ubuntuone_installer/gui/qt/utils/windows.py 2011-09-22 19:40:28 +0000
243+++ ubuntuone_installer/gui/qt/utils/windows.py 2011-09-28 17:34:23 +0000
244@@ -31,7 +31,7 @@
245 # pylint: enable=F0401
246
247 from twisted.internet import defer
248-from twisted.internet.utils import getProcessValue
249+from twisted.internet.utils import getProcessValue
250
251 AUTORUN_KEY = r"Software\Microsoft\Windows\CurrentVersion\Run"
252

Subscribers

People subscribed via source and target branches