~ubuntu-branches/ubuntu/precise/ubuntu-sso-client/precise

« back to all changes in this revision

Viewing changes to ubuntu_sso/qt/tests/test_setup_account.py

  • Committer: Package Import Robot
  • Author(s): Natalia Bidart (nessita)
  • Date: 2012-02-22 16:53:51 UTC
  • mfrom: (1.1.32)
  • Revision ID: package-import@ubuntu.com-20120222165351-fvzfkcni6bq18goo
Tags: 2.99.5-0ubuntu1
* New upstream release:
  - Captcha loading is no longer failing for the Qt UI (LP: #933679).
  - Added stylesheets for the Qt UI.
  - Fixed: Qt UI: must call the backend passing reply_handler
    and error_handler (LP: #931452).
  - Make gettext return unicode strings. Also, transform arguments passed
    to the GLib spawnner to bytes (LP: #933632).
  - Try to load the qt main/ implementation when possible, if not default
    to the glib (LP: #933534).
  - Make the bin_dir discoverable when running from the system installation
    (LP: #933039).
  - Implement (so far dummy) timeout_func for the Qt frontend (LP: #933758).
* debian/control:
  - adding missing dependency on gnome-keyring for python-ubuntu-sso-client
    (LP: #938693).
* debian/patches/fix-938626.patch:
  - No more strings coming up from the Designer ui files so we ensure that
    those are marked for translation (LP: #938626).
* debian/watch: updated milestone to 2.99.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
        self.signals_results = []
45
45
        self.patch(setup_account_page.SetupAccountPage,
46
46
            "userRegistered", FakeSignal())
 
47
        self.app_name = 'my_app'
47
48
        self.ui = setup_account_page.SetupAccountPage(
48
49
            setup_account_ui.Ui_SetUpAccountPage(),
49
50
            'subtitle',
50
51
            'toc_link',
51
52
            'policy_link',
 
53
            app_name=self.app_name,
52
54
            parent=None)
53
55
        self.wizard = FakeWizard()
54
56
        self.patch(self.ui, 'wizard', lambda: self.wizard)
75
77
            setup_account_page.ERROR % setup_account_page.EMPTY_NAME)
76
78
        self.ui.hide()
77
79
 
 
80
    def test_enable_setup_button_with_visible_check(self):
 
81
        """Test _enable_setup_button method with terms check visible."""
 
82
        self.ui.ui.name_edit.setText('name')
 
83
        email = 'email@example.com'
 
84
        self.ui.ui.email_edit.setText(email)
 
85
        self.ui.ui.confirm_email_edit.setText(email)
 
86
        password = 'T3st3rqwe'
 
87
        self.ui.ui.password_edit.setText(password)
 
88
        self.ui.ui.confirm_password_edit.setText(password)
 
89
        self.ui.ui.captcha_solution_edit.setText('captcha solution')
 
90
        self.ui.terms_checkbox.setChecked(True)
 
91
 
 
92
        self.ui.show()
 
93
        self.addCleanup(self.ui.hide)
 
94
        self.ui.terms_checkbox.setVisible(True)
 
95
        self.ui.ui.captcha_solution_edit.textEdited.emit('')
 
96
        self.assertTrue(self.ui.set_up_button.isEnabled())
 
97
 
 
98
    def test_enable_setup_button_without_visible_check(self):
 
99
        """Test _enable_setup_button method with terms check not visible."""
 
100
        self.ui.ui.name_edit.setText('name')
 
101
        email = 'email@example.com'
 
102
        self.ui.ui.email_edit.setText(email)
 
103
        self.ui.ui.confirm_email_edit.setText(email)
 
104
        password = 'T3st3rqwe'
 
105
        self.ui.ui.password_edit.setText(password)
 
106
        self.ui.ui.confirm_password_edit.setText(password)
 
107
        self.ui.ui.captcha_solution_edit.setText('captcha solution')
 
108
 
 
109
        self.ui.show()
 
110
        self.addCleanup(self.ui.hide)
 
111
        self.ui.terms_checkbox.setVisible(False)
 
112
        self.ui.ui.captcha_solution_edit.textEdited.emit('')
 
113
        self.assertTrue(self.ui.set_up_button.isEnabled())
 
114
 
78
115
    def test_password_default_assistance(self):
79
116
        """Status when the password line edit receive focus and shows popup.
80
117
 
155
192
            self.signals_results.append((email, password))
156
193
        self.ui.userRegistered.connect(slot)
157
194
        self.ui.set_next_validation()
158
 
        self.assertTrue((email, password) in self.signals_results)
 
195
        self.assertIn((email, password), self.signals_results)
 
196
        self.assert_backend_called('register_user',
 
197
            self.app_name, email, password, name, captcha_id,
 
198
            captcha_solution)
159
199
 
160
200
    def test_set_next_validation(self):
161
201
        """Test on_user_registered method."""
169
209
            self.signals_results.append((email, password))
170
210
        self.ui.userRegistered.connect(slot)
171
211
        self.ui.on_user_registered('app_name', None)
172
 
        self.assertTrue((email, password) in self.signals_results)
 
212
        self.assertIn((email, password), self.signals_results)
 
213
 
 
214
    def test_captcha_image_is_requested_as_startup(self):
 
215
        """The captcha image is requested at startup."""
 
216
        # assert generate_captcha was called
 
217
        self.assert_backend_called('generate_captcha',
 
218
            self.app_name, self.ui.captcha_file)
173
219
 
174
220
 
175
221
class SetupAccountFakeWizardTestCase(BaseTestCase):