~nataliabidart/ubuntuone-control-panel/u1cp-windows-styling

« back to all changes in this revision

Viewing changes to ubuntuone/controlpanel/gui/qt/tests/test_wizard.py

  • Committer: Tarmac
  • Author(s): Natalia B. Bidart
  • Date: 2012-03-20 22:23:18 UTC
  • mfrom: (290.1.3 license-page)
  • Revision ID: tarmac-20120320222318-plor3ai4lrvyj13m
- Added the "License" page to the wizard (part of LP: #933697). So far is not visible from a regular run, will be enabled for windows only in another branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
95
95
        self.assertFalse(self.ui.isFinalPage())
96
96
 
97
97
 
 
98
class LicensePageTestCase(UbuntuOnePageTestCase):
 
99
    """Test the LicensePage wizard page."""
 
100
 
 
101
    class_ui = gui.LicensePage
 
102
    panel_class = gui.QtGui.QTextBrowser
 
103
 
 
104
    def test_content(self):
 
105
        """The page content is correct."""
 
106
        expected = gui.QtGui.QTextBrowser()
 
107
        expected.setHtml(gui.LICENSE_CONTENT)
 
108
        self.assertEqual(self.ui.panel.toHtml(), expected.toHtml())
 
109
 
 
110
 
98
111
class SignInPageTestCase(UbuntuOnePageTestCase):
99
112
    """Test the SignInPage wizard page."""
100
113
 
140
153
 
141
154
    class_ui = gui.UbuntuOneWizard
142
155
    confirm_response = gui.QtGui.QDialog.Accepted
 
156
    show_license = False
143
157
 
144
158
    @defer.inlineCallbacks
145
159
    def setUp(self):
 
160
        self.patch(self.class_ui, 'show_license', self.show_license)
146
161
        yield super(UbuntuOneWizardTestCase, self).setUp()
147
162
        self.patch(self.ui.confirm_dialog, 'exec_',
148
163
                   lambda: self.confirm_response)
171
186
 
172
187
    def test_first_page(self):
173
188
        """The first page is the correct one."""
174
 
        expected = self.ui.pages[self.ui.signin_page]
 
189
        if self.show_license:
 
190
            expected = self.ui.pages[self.ui.license_page]
 
191
        else:
 
192
            expected = self.ui.pages[self.ui.signin_page]
 
193
 
175
194
        self.assertEqual(self.ui.startId(), expected)
176
195
 
177
196
    def test_done_accepted(self):
183
202
        self.assertEqual(self._called, ((gui.QtGui.QDialog.Accepted,), {}))
184
203
 
185
204
 
 
205
class LicensedUbuntuOneWizardTestCase(UbuntuOneWizardTestCase):
 
206
    """Test the LicensedUbuntuOneWizard."""
 
207
 
 
208
    show_license = True
 
209
 
 
210
 
186
211
class UbuntuOneWizardSignInTestCase(UbuntuOneWizardTestCase):
187
212
    """Test the SignInPage wizard page."""
188
213
 
312
337
        # does not apply to this page
313
338
 
314
339
 
 
340
class UbuntuOneWizardLicensePage(UbuntuOneWizardSignInTestCase):
 
341
    """Test the LicensePage wizard page."""
 
342
 
 
343
    buttons = {
 
344
        'NextButton': (gui.LICENSE_AGREE, 'currentIdChanged', (1,)),
 
345
        'CancelButton': (gui.LICENSE_DISAGREE, 'rejected', ()),
 
346
    }
 
347
    page_name = 'license'
 
348
    show_license = True
 
349
    stage_name = 'install'
 
350
 
 
351
 
315
352
class UbuntuOneWizardLoginTestCase(UbuntuOneWizardTestCase):
316
353
    """Test the login through the wizard."""
317
354