Merge lp:~nataliabidart/ubuntuone-windows-installer/setup-button into lp:ubuntuone-windows-installer
- setup-button
- Merge into trunk
Proposed by
Natalia Bidart
Status: | Merged |
---|---|
Approved by: | Natalia Bidart |
Approved revision: | 67 |
Merged at revision: | 69 |
Proposed branch: | lp:~nataliabidart/ubuntuone-windows-installer/setup-button |
Merge into: | lp:ubuntuone-windows-installer |
Diff against target: |
600 lines (+214/-152) 7 files modified
run-tests (+2/-1) ubuntuone_installer/gui/qt/gui.py (+4/-4) ubuntuone_installer/gui/qt/setup_account.py (+3/-1) ubuntuone_installer/gui/qt/tests/__init__.py (+106/-1) ubuntuone_installer/gui/qt/tests/test_gui.py (+31/-77) ubuntuone_installer/gui/qt/tests/test_local_folders.py (+1/-0) ubuntuone_installer/gui/qt/tests/test_setup_account.py (+67/-68) |
To merge this branch: | bzr merge lp:~nataliabidart/ubuntuone-windows-installer/setup-button |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Manuel de la Peña (community) | Approve | ||
Diego Sarmentero (community) | Approve | ||
Review via email:
|
Commit message
- Improved the test suite for set_up_button handling.
Description of the change
To post a comment you must log in.
- 66. By Natalia Bidart
-
Merged trunk in.
- 67. By Natalia Bidart
-
All test green.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Manuel de la Peña (mandel) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'run-tests' |
2 | --- run-tests 2011-08-24 15:24:03 +0000 |
3 | +++ run-tests 2011-09-16 13:04:24 +0000 |
4 | @@ -27,7 +27,8 @@ |
5 | fi |
6 | |
7 | style_check() { |
8 | - u1lint --ignore ubuntuone_installer/gui/qt/ui |
9 | + ./setup.py clean |
10 | + u1lint |
11 | if [ -x `which pep8` ]; then |
12 | pep8 --exclude '.svn,CVS,.bzr,.hg,.git,*_ui.py,*_rc.py' --repeat . |
13 | else |
14 | |
15 | === modified file 'ubuntuone_installer/gui/qt/gui.py' |
16 | --- ubuntuone_installer/gui/qt/gui.py 2011-09-15 19:10:23 +0000 |
17 | +++ ubuntuone_installer/gui/qt/gui.py 2011-09-16 13:04:24 +0000 |
18 | @@ -305,8 +305,8 @@ |
19 | # Add the pages in the right order |
20 | # pylint: disable=C0103 |
21 | |
22 | - self.LICENSE_PAGE = LicensePage() |
23 | - self.LICENSE_PAGE_ID = self.addPage(self.LICENSE_PAGE) |
24 | + self.license_page = LicensePage() |
25 | + self.LICENSE_PAGE = self.addPage(self.license_page) |
26 | |
27 | #SSO Pages |
28 | title_page = TITLE_STYLE % SIGN_IN |
29 | @@ -389,7 +389,7 @@ |
30 | self.button(QtGui.QWizard.NextButton).setDefault(True) |
31 | |
32 | if installing: |
33 | - self.setStartId(self.LICENSE_PAGE_ID) |
34 | + self.setStartId(self.LICENSE_PAGE) |
35 | else: |
36 | self.setStartId(self.SIGNIN_PAGE) |
37 | self.restart() |
38 | @@ -440,7 +440,7 @@ |
39 | # Finished, not cancelled |
40 | if result == 1: # Cancelled |
41 | qt.utils.start_control_panel() |
42 | - elif self.currentId() == self.LICENSE_PAGE_ID: |
43 | + elif self.currentId() == self.LICENSE_PAGE: |
44 | if not AreYouSure(self).exec_(): |
45 | qt.utils.uninstall_application() |
46 | else: |
47 | |
48 | === modified file 'ubuntuone_installer/gui/qt/setup_account.py' |
49 | --- ubuntuone_installer/gui/qt/setup_account.py 2011-09-15 18:00:49 +0000 |
50 | +++ ubuntuone_installer/gui/qt/setup_account.py 2011-09-16 13:04:24 +0000 |
51 | @@ -25,6 +25,7 @@ |
52 | |
53 | from ubuntu_sso.qt import common |
54 | from ubuntu_sso.qt import gui as sso_gui |
55 | +from ubuntu_sso.utils.ui import SET_UP_ACCOUNT_BUTTON |
56 | |
57 | from ubuntuone_installer.gui.qt import enhanced_check_box |
58 | |
59 | @@ -98,9 +99,10 @@ |
60 | self.wizard().customButtonClicked.disconnect() |
61 | except TypeError: |
62 | pass |
63 | - self.setButtonText(QtGui.QWizard.CustomButton3, _('Set Up Account')) |
64 | + self.setButtonText(QtGui.QWizard.CustomButton3, SET_UP_ACCOUNT_BUTTON) |
65 | self.set_up_button = self.wizard().button(QtGui.QWizard.CustomButton3) |
66 | self.set_up_button.clicked.connect(self.wizard().overlay.show) |
67 | + self.set_up_button.clicked.connect(self.controller.set_next_validation) |
68 | self.set_up_button.setEnabled(False) |
69 | |
70 | self.ui.name_label.setText(NAME) |
71 | |
72 | === modified file 'ubuntuone_installer/gui/qt/tests/__init__.py' |
73 | --- ubuntuone_installer/gui/qt/tests/__init__.py 2011-09-01 18:12:12 +0000 |
74 | +++ ubuntuone_installer/gui/qt/tests/__init__.py 2011-09-16 13:04:24 +0000 |
75 | @@ -18,8 +18,11 @@ |
76 | |
77 | """The test suite for the Qt UI of the Ubuntu One Installer.""" |
78 | |
79 | +from PyQt4 import QtGui, QtCore |
80 | +from ubuntuone.controlpanel.gui.qt import loadingoverlay |
81 | + |
82 | +from ubuntuone_installer.gui.tests import FakedObject |
83 | from ubuntuone_installer.tests import TestCase |
84 | -from ubuntuone_installer.gui.tests import FakedObject |
85 | |
86 | # Attribute 'yyy' defined outside __init__, access to a protected member |
87 | # pylint: disable=W0201, W0212 |
88 | @@ -34,6 +37,106 @@ |
89 | exposed_methods = ['setupUi'] |
90 | |
91 | |
92 | +class FakeSignal(object): |
93 | + |
94 | + """A fake PyQt signal.""" |
95 | + |
96 | + def __init__(self, *args, **kwargs): |
97 | + """Initialize.""" |
98 | + self.target = None |
99 | + |
100 | + def connect(self, target): |
101 | + """Fake connect.""" |
102 | + self.target = target |
103 | + |
104 | + def disconnect(self, *args): |
105 | + """Fake disconnect.""" |
106 | + self.target = None |
107 | + |
108 | + def emit(self, *args): |
109 | + """Fake emit.""" |
110 | + if self.target: |
111 | + self.target(*args) |
112 | + |
113 | + |
114 | +class FakeController(object): |
115 | + |
116 | + """A fake controller for the tests.""" |
117 | + |
118 | + is_fake = True |
119 | + set_next_validation = lambda *a, **kw: None |
120 | + |
121 | + def __init__(self, *args, **kwargs): |
122 | + self.args = (args, kwargs) |
123 | + |
124 | + # pylint: disable=C0103 |
125 | + def setupUi(self, view): |
126 | + """Fake the setup.""" |
127 | + # pylint: enable=C0103 |
128 | + |
129 | + |
130 | +class FakeOverlay(object): |
131 | + |
132 | + """A fake delay overlay.""" |
133 | + |
134 | + def __init__(self, *args, **kwargs): |
135 | + """Initialize.""" |
136 | + self.show_counter = 0 |
137 | + self.hide_counter = 0 |
138 | + self.args = (args, kwargs) |
139 | + |
140 | + def show(self): |
141 | + """Fake show.""" |
142 | + self.show_counter += 1 |
143 | + |
144 | + def hide(self): |
145 | + """Fake hide.""" |
146 | + self.hide_counter += 1 |
147 | + |
148 | + def resize(self, *args): |
149 | + """Fake resize.""" |
150 | + |
151 | + |
152 | +class FakeWizard(object): |
153 | + """Replace wizard() function on wizard pages.""" |
154 | + |
155 | + customButtonClicked = QtCore.QObject() |
156 | + |
157 | + def __init__(self): |
158 | + self.overlay = FakeOverlay() |
159 | + self.called = [] |
160 | + self.buttons = {} |
161 | + |
162 | + # Invalid name "setButtonLayout", "setOption" |
163 | + # pylint: disable=C0103 |
164 | + |
165 | + def setButtonLayout(self, *args, **kwargs): |
166 | + """Fake the functionality of setButtonLayout on QWizard class.""" |
167 | + self.called.append(('setButtonLayout', (args, kwargs))) |
168 | + |
169 | + def setOption(self, *args, **kwargs): |
170 | + """Fake the functionality of setOption on QWizard class.""" |
171 | + self.called.append(('setOption', (args, kwargs))) |
172 | + |
173 | + # pylint: enable=C0103 |
174 | + |
175 | + def button(self, button_id): |
176 | + """Fake the functionality of button on QWizard class.""" |
177 | + return self.buttons.setdefault(button_id, QtGui.QPushButton()) |
178 | + |
179 | + |
180 | +class FakeWizardPage(object): |
181 | + |
182 | + """A fake wizard page.""" |
183 | + |
184 | + def __init__(self, *args, **kwargs): |
185 | + self.has_back_button = True |
186 | + |
187 | + # pylint: disable=C0103 |
188 | + def initializePage(self): |
189 | + """Fake initializePage.""" |
190 | + |
191 | + |
192 | class BaseTestCase(TestCase): |
193 | """Base Test Case.""" |
194 | |
195 | @@ -52,3 +155,5 @@ |
196 | if hasattr(self.ui, 'backend'): |
197 | # clean backend calls |
198 | self.ui.backend._called.clear() |
199 | + |
200 | + self.patch(loadingoverlay, 'LoadingOverlay', FakeOverlay) |
201 | |
202 | === modified file 'ubuntuone_installer/gui/qt/tests/test_gui.py' |
203 | --- ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-15 22:02:03 +0000 |
204 | +++ ubuntuone_installer/gui/qt/tests/test_gui.py 2011-09-16 13:04:24 +0000 |
205 | @@ -25,21 +25,14 @@ |
206 | |
207 | from ubuntuone_installer.gui import NEXT |
208 | from ubuntuone_installer.gui.qt import gui, forgotten, utils |
209 | -from ubuntuone_installer.gui.qt.tests import BaseTestCase, NO_OP |
210 | - |
211 | - |
212 | -class FakeController(object): |
213 | - |
214 | - """A fake controller for the tests.""" |
215 | - |
216 | - def __init__(self, *args, **kwargs): |
217 | - self.args = (args, kwargs) |
218 | - |
219 | - # pylint: disable=C0103 |
220 | - def setupUi(self, view): |
221 | - """Fake the setup.""" |
222 | - # pylint: enable=C0103 |
223 | - is_fake = True |
224 | +from ubuntuone_installer.gui.qt.tests import ( |
225 | + BaseTestCase, |
226 | + FakeController, |
227 | + FakeOverlay, |
228 | + FakeSignal, |
229 | + FakeWizardPage, |
230 | + NO_OP, |
231 | +) |
232 | |
233 | |
234 | class FakeAreYouSure(object): |
235 | @@ -58,28 +51,6 @@ |
236 | return self.result # Means reject |
237 | |
238 | |
239 | -class FakeOverlay(object): |
240 | - |
241 | - """A fake delay overlay.""" |
242 | - |
243 | - def __init__(self, *args, **kwargs): |
244 | - """Initialize.""" |
245 | - self.show_counter = 0 |
246 | - self.hide_counter = 0 |
247 | - self.args = (args, kwargs) |
248 | - |
249 | - def show(self): |
250 | - """Fake show.""" |
251 | - self.show_counter += 1 |
252 | - |
253 | - def hide(self): |
254 | - """Fake hide.""" |
255 | - self.hide_counter += 1 |
256 | - |
257 | - def resize(self, *args): |
258 | - """Fake resize.""" |
259 | - |
260 | - |
261 | class FakeLocalFoldersPage(QtGui.QWizardPage): |
262 | """Fake Local Folders Page.""" |
263 | |
264 | @@ -195,7 +166,7 @@ |
265 | def test_with_flag(self): |
266 | """test with flag activated.""" |
267 | win = gui.MainWindow(installing=True) |
268 | - self.assertEqual(win.startId(), win.LICENSE_PAGE_ID) |
269 | + self.assertEqual(win.startId(), win.LICENSE_PAGE) |
270 | self.assertEqual( |
271 | unicode(self.ui.sign_in_page.ui.message_label.text()), |
272 | u"") |
273 | @@ -244,7 +215,7 @@ |
274 | |
275 | def test_execute_uninstall_on_licence_cancel(self): |
276 | """Pressing Disagree button from license page the uninstall is exec.""" |
277 | - self.ui.setStartId(self.ui.LICENSE_PAGE_ID) |
278 | + self.ui.setStartId(self.ui.LICENSE_PAGE) |
279 | self.ui.restart() |
280 | self.ui.show() |
281 | self.addCleanup(self.ui.hide) |
282 | @@ -255,7 +226,7 @@ |
283 | |
284 | def test_execute_uninstall_on_licence_cancel_frozen(self): |
285 | """Pressing Disagree button from license page the uninstall is exec.""" |
286 | - self.ui.setStartId(self.ui.LICENSE_PAGE_ID) |
287 | + self.ui.setStartId(self.ui.LICENSE_PAGE) |
288 | self.ui.restart() |
289 | self.ui.show() |
290 | self.addCleanup(self.ui.hide) |
291 | @@ -436,7 +407,7 @@ |
292 | |
293 | def test_next_hides_overlay(self): |
294 | """Make sure next() hides the overlay.""" |
295 | - self.ui.setStartId(self.ui.LICENSE_PAGE_ID) |
296 | + self.ui.setStartId(self.ui.LICENSE_PAGE) |
297 | self.ui.restart() |
298 | self.ui.show() |
299 | self.addCleanup(self.ui.hide) |
300 | @@ -447,11 +418,11 @@ |
301 | |
302 | def test_insert_remove_critical_message(self): |
303 | """Make sure critical message is added and next() removes it.""" |
304 | - self.ui.setStartId(self.ui.LICENSE_PAGE_ID) |
305 | + self.ui.setStartId(self.ui.LICENSE_PAGE) |
306 | self.ui.restart() |
307 | self.ui.show() |
308 | self.addCleanup(self.ui.hide) |
309 | - license_page = self.ui.page(self.ui.LICENSE_PAGE_ID) |
310 | + license_page = self.ui.page(self.ui.LICENSE_PAGE) |
311 | self.assertEqual(self.ui.form_errors_label.parentWidget(), None) |
312 | self.ui.critical("test critical message") |
313 | self.assertEqual(self.ui.form_errors_label.parentWidget(), |
314 | @@ -534,7 +505,7 @@ |
315 | |
316 | def test_stage_progression_1(self): |
317 | """Check that each page in the wizard sets the correct stage.""" |
318 | - self.ui.on_currentIdChanged(self.ui.LICENSE_PAGE_ID) |
319 | + self.ui.on_currentIdChanged(self.ui.LICENSE_PAGE) |
320 | self.assertEqual(self.ui.sideWidget().stage, 0) |
321 | |
322 | def test_stage_progression_2(self): |
323 | @@ -608,39 +579,22 @@ |
324 | # Check if syncdaemon was added to autostart |
325 | self.assertEqual(self._called, ((), {})) |
326 | |
327 | - |
328 | -class FakeSignal(object): |
329 | - |
330 | - """A fake PyQt signal.""" |
331 | - |
332 | - def __init__(self, *args, **kwargs): |
333 | - """Initialize.""" |
334 | - self.target = None |
335 | - |
336 | - def connect(self, target): |
337 | - """Fake connect.""" |
338 | - self.target = target |
339 | - |
340 | - def disconnect(self, *args): |
341 | - """Fake disconnect.""" |
342 | - self.target = None |
343 | - |
344 | - def emit(self, *args): |
345 | - """Fake emit.""" |
346 | - if self.target: |
347 | - self.target(*args) |
348 | - |
349 | - |
350 | -class FakeWizardPage(object): |
351 | - |
352 | - """A fake wizard page.""" |
353 | - |
354 | - def __init__(self, *args, **kwargs): |
355 | - self.has_back_button = True |
356 | - |
357 | - # pylint: disable=C0103 |
358 | - def initializePage(self): |
359 | - """Fake initializePage.""" |
360 | + def test_side_widget_state(self): |
361 | + """Test if the side widget of the wizard has state frame visible.""" |
362 | + self.ui.show() |
363 | + self.addCleanup(self.ui.hide) |
364 | + |
365 | + self.ui.on_currentIdChanged(self.ui.LICENSE_PAGE) |
366 | + self.assertFalse(self.ui.sideWidget().ui.states_frame.isVisible()) |
367 | + |
368 | + self.ui.on_currentIdChanged(self.ui.SIGNIN_PAGE) |
369 | + self.assertTrue(self.ui.sideWidget().ui.states_frame.isVisible()) |
370 | + |
371 | + self.ui.on_currentIdChanged(self.ui.local_folders_page_id) |
372 | + self.assertTrue(self.ui.sideWidget().ui.states_frame.isVisible()) |
373 | + |
374 | + self.ui.on_currentIdChanged(self.ui.CONGRATULATIONS_PAGE) |
375 | + self.assertTrue(self.ui.sideWidget().ui.states_frame.isVisible()) |
376 | |
377 | |
378 | class FakeMainWindow(object): |
379 | |
380 | === modified file 'ubuntuone_installer/gui/qt/tests/test_local_folders.py' |
381 | --- ubuntuone_installer/gui/qt/tests/test_local_folders.py 2011-09-13 02:07:43 +0000 |
382 | +++ ubuntuone_installer/gui/qt/tests/test_local_folders.py 2011-09-16 13:04:24 +0000 |
383 | @@ -452,6 +452,7 @@ |
384 | @defer.inlineCallbacks |
385 | def test_add_folder_valid_starts_selected(self): |
386 | """When adding a valid folder, it starts as selected.""" |
387 | + self.patch(self.ui, 'update_sizes', lambda: None) |
388 | self.patch(QtGui, "QFileDialog", FakeFileDialog()) |
389 | yield self.ui.on_add_folder_button_clicked() |
390 | self.assertEqual( |
391 | |
392 | === modified file 'ubuntuone_installer/gui/qt/tests/test_setup_account.py' |
393 | --- ubuntuone_installer/gui/qt/tests/test_setup_account.py 2011-09-15 18:00:49 +0000 |
394 | +++ ubuntuone_installer/gui/qt/tests/test_setup_account.py 2011-09-16 13:04:24 +0000 |
395 | @@ -24,54 +24,13 @@ |
396 | |
397 | from ubuntu_sso.qt import common |
398 | |
399 | -from ubuntuone_installer.gui.qt import gui, setup_account |
400 | -from ubuntuone_installer.gui.qt.tests import BaseTestCase |
401 | -from ubuntuone_installer.gui.qt.ui import ( |
402 | - setup_account_ui, |
403 | +from ubuntuone_installer.gui.qt import setup_account as gui |
404 | +from ubuntuone_installer.gui.qt.tests import ( |
405 | + BaseTestCase, |
406 | + FakeController, |
407 | + FakeWizard, |
408 | ) |
409 | - |
410 | - |
411 | -class FakeController(object): |
412 | - |
413 | - """A fake controller for the tests.""" |
414 | - |
415 | - def __init__(self, *args, **kwargs): |
416 | - self.args = (args, kwargs) |
417 | - |
418 | - # pylint: disable=C0103 |
419 | - def setupUi(self, view): |
420 | - """Fake the setup.""" |
421 | - # pylint: enable=C0103 |
422 | - |
423 | - |
424 | -class FakeWizard(object): |
425 | - """Replace wizard() function on wizard pages.""" |
426 | - |
427 | - customButtonClicked = QtCore.QObject() |
428 | - overlay = None |
429 | - params = None |
430 | - |
431 | - # Invalid name "setButtonLayout" |
432 | - # pylint: disable=C0103 |
433 | - |
434 | - def setButtonLayout(self, *args, **kwargs): |
435 | - """Fake the functionality of setButtonLayout on QWizard class.""" |
436 | - FakeWizard.params = (args, kwargs) |
437 | - |
438 | - # pylint: enable=C0103 |
439 | - |
440 | - # Invalid name "setOption" |
441 | - # pylint: disable=C0103 |
442 | - |
443 | - def setOption(self, *args, **kwargs): |
444 | - """Fake the functionality of setOption on QWizard class.""" |
445 | - FakeWizard.params = (args, kwargs) |
446 | - |
447 | - # pylint: enable=C0103 |
448 | - |
449 | - def button(self, *args, **kwargs): |
450 | - """Fake the functionality of button on QWizard class.""" |
451 | - return QtGui.QPushButton() |
452 | +from ubuntuone_installer.gui.qt.ui import setup_account_ui |
453 | |
454 | |
455 | class FakeValidationDict(object): |
456 | @@ -108,7 +67,7 @@ |
457 | class SetupAccountTestCase(BaseTestCase): |
458 | """Test the SetupAccountPage code.""" |
459 | |
460 | - class_ui = setup_account.SetupAccountPage |
461 | + class_ui = gui.SetupAccountPage |
462 | kwargs = dict( |
463 | ui=setup_account_ui.Ui_SetUpAccountPage(), |
464 | controller=FakeController(), |
465 | @@ -138,7 +97,7 @@ |
466 | self.assertTrue(self.ui.ui.name_assistance.isVisible()) |
467 | self.assertEqual( |
468 | unicode(self.ui.ui.name_assistance.text()), |
469 | - setup_account.ERROR % setup_account.EMPTY_NAME) |
470 | + gui.ERROR % gui.EMPTY_NAME) |
471 | self.ui.hide() |
472 | |
473 | def test_password_default_assistance(self): |
474 | @@ -163,19 +122,6 @@ |
475 | unicode(self.ui.ui.password_assistance.text()), |
476 | ) |
477 | |
478 | - def test_side_widget_state(self): |
479 | - """Test if the side widget of the wizard has state frame visible.""" |
480 | - if type(self.ui) != gui.MainWindow: |
481 | - return |
482 | - self.ui.on_currentIdChanged(self.ui.LICENSE_PAGE) |
483 | - self.assertTrue(self.ui.sideWidget().ui.states_frame.isVisible()) |
484 | - self.ui.on_currentIdChanged(self.ui.SIGNIN_PAGE) |
485 | - self.assertTrue(self.ui.sideWidget().ui.states_frame.isVisible()) |
486 | - self.ui.on_currentIdChanged(self.ui.local_folders_page_id) |
487 | - self.assertTrue(self.ui.sideWidget().ui.states_frame.isVisible()) |
488 | - self.ui.on_currentIdChanged(self.ui.CONGRATULATIONS_PAGE) |
489 | - self.assertTrue(self.ui.sideWidget().ui.states_frame.isVisible()) |
490 | - |
491 | def test_focus_changed_1(self): |
492 | """Check functions execution when focus_changed() is executed.""" |
493 | self.patch(self.ui, 'validation_functions', FakeValidationDict()) |
494 | @@ -216,7 +162,7 @@ |
495 | class SetupAccountFakeWizardTestCase(BaseTestCase): |
496 | """Test the SetupAccountPage code.""" |
497 | |
498 | - class_ui = setup_account.SetupAccountPage |
499 | + class_ui = gui.SetupAccountPage |
500 | kwargs = dict( |
501 | ui=setup_account_ui.Ui_SetUpAccountPage(), |
502 | controller=FakeController(), |
503 | @@ -228,7 +174,60 @@ |
504 | # Faking each SSO object instead of doing it lower |
505 | # so we don't rely on any SSO behaviour |
506 | super(SetupAccountFakeWizardTestCase, self).setUp() |
507 | - self.patch(self.ui, 'wizard', FakeWizard) |
508 | + self.wizard = FakeWizard() |
509 | + self.patch(self.ui, 'wizard', lambda: self.wizard) |
510 | + |
511 | + def test_initialize_page(self): |
512 | + """Widgets are properly initialized.""" |
513 | + self.ui.initializePage() |
514 | + self.ui.show() |
515 | + self.addCleanup(self.ui.hide) |
516 | + |
517 | + # titles |
518 | + self.assertEqual(self.ui.header.title_label.text(), |
519 | + gui.TITLE_STYLE % gui.TITLE) |
520 | + self.assertEqual(self.ui.header.subtitle_label.text(), gui.SUBTITLE) |
521 | + |
522 | + # set up account button |
523 | + expected = [QtGui.QWizard.BackButton, QtGui.QWizard.Stretch, |
524 | + QtGui.QWizard.CustomButton3] |
525 | + self.assertIn(('setButtonLayout', ((expected,), {})), |
526 | + self.ui.wizard().called) |
527 | + self.assertEqual(gui.SET_UP_ACCOUNT_BUTTON, |
528 | + self.ui.buttonText(QtGui.QWizard.CustomButton3)) |
529 | + self.assertTrue(self.ui.wizard().button(QtGui.QWizard.CustomButton3) is |
530 | + self.ui.set_up_button) |
531 | + self.assertFalse(self.ui.set_up_button.isEnabled()) |
532 | + |
533 | + # labels |
534 | + self.assertEqual(self.ui.ui.name_label.text(), gui.NAME) |
535 | + self.assertEqual(self.ui.ui.email_label.text(), gui.EMAIL) |
536 | + self.assertEqual(self.ui.ui.confirm_email_label.text(), |
537 | + gui.RETYPE_EMAIL) |
538 | + self.assertEqual(self.ui.ui.password_label.text(), |
539 | + gui.PASSWORD) |
540 | + self.assertEqual(self.ui.ui.confirm_password_label.text(), |
541 | + gui.RETYPE_PASSWORD) |
542 | + self.assertFalse(self.ui.ui.password_info_label.isVisible()) |
543 | + |
544 | + # assistants |
545 | + self.assertFalse(self.ui.ui.name_assistance.isVisible()) |
546 | + self.assertFalse(self.ui.ui.email_assistance.isVisible()) |
547 | + self.assertFalse(self.ui.ui.confirm_email_assistance.isVisible()) |
548 | + self.assertFalse(self.ui.ui.password_assistance.isVisible()) |
549 | + self.assertTrue(self.ui.ui.refresh_label.isVisible()) |
550 | + |
551 | + def test_set_up_button_clicked(self): |
552 | + """Validation and overlay is shown when the setupbutton is clicked.""" |
553 | + self.patch(self.ui.controller, 'set_next_validation', self._set_called) |
554 | + self.ui.initializePage() |
555 | + self.ui.show() |
556 | + self.addCleanup(self.ui.hide) |
557 | + |
558 | + self.ui.set_up_button.clicked.emit(False) |
559 | + |
560 | + self.assertEqual(self.ui.wizard().overlay.show_counter, 1) |
561 | + self.assertEqual(self._called, ((False,), {})) |
562 | |
563 | def test_set_error_message(self): |
564 | """Check the state of the label after calling: set_error_message.""" |
565 | @@ -239,7 +238,7 @@ |
566 | self.assertTrue(self.ui.ui.email_assistance.isVisible()) |
567 | self.assertEqual( |
568 | unicode(self.ui.ui.email_assistance.text()), |
569 | - setup_account.ERROR % "message") |
570 | + gui.ERROR % "message") |
571 | |
572 | def test_blank_name(self): |
573 | """Status when the name field is blank (spaces). |
574 | @@ -254,7 +253,7 @@ |
575 | self.assertTrue(self.ui.ui.name_assistance.isVisible()) |
576 | self.assertEqual( |
577 | unicode(self.ui.ui.name_assistance.text()), |
578 | - setup_account.ERROR % setup_account.EMPTY_NAME) |
579 | + gui.ERROR % gui.EMPTY_NAME) |
580 | self.ui.hide() |
581 | |
582 | def test_valid_name(self): |
583 | @@ -282,7 +281,7 @@ |
584 | self.assertTrue(self.ui.ui.email_assistance.isVisible()) |
585 | self.assertEqual( |
586 | unicode(self.ui.ui.email_assistance.text()), |
587 | - setup_account.ERROR % setup_account.INVALID_EMAIL) |
588 | + gui.ERROR % gui.INVALID_EMAIL) |
589 | |
590 | def test_valid_email(self): |
591 | """Status when the email field has a @. |
592 | @@ -323,7 +322,7 @@ |
593 | self.assertTrue(self.ui.ui.confirm_email_assistance.isVisible()) |
594 | self.assertEqual( |
595 | unicode(self.ui.ui.confirm_email_assistance.text()), |
596 | - setup_account.ERROR % setup_account.EMAIL_MATCH) |
597 | + gui.ERROR % gui.EMAIL_MATCH) |
598 | self.ui.hide() |
599 | |
600 | def test_focus_changed_password_visibility(self): |
+1