103
114
self.widget = ChooseSignInPage(self.ui, self.controller)
116
def test_email(self):
117
"""Test the email property."""
118
# set the email in the ui and test that the result is the expected one
119
email = 'manuel@canonical.com'
120
self.ui.email_edit.setText(email)
121
self.assertEqual(email, self.widget.email)
123
def test_email_edit(self):
124
"""Test the email edit property."""
125
self.assertEqual(self.ui.email_edit, self.widget.email_edit)
127
def test_password(self):
128
"""Test the password property."""
129
# set password in the ui and test that the result is the correct one
130
password = 'password'
131
self.ui.password_edit.setText(password)
132
self.assertEqual(password, self.widget.password)
134
def test_password_edit(self):
135
"""Test the password edit property."""
136
self.assertEqual(self.ui.password_edit, self.widget.password_edit)
138
def test_forgot_password_label(self):
139
"""Test the password forgto label."""
140
self.assertEqual(self.ui.forgot_label,
141
self.widget.forgot_password_label)
143
def test_signin_button(self):
144
"""Test the sign in button property."""
145
self.assertEqual(self.ui.sign_in_button, self.widget.sign_in_button)
106
148
class EmailVerificationPageTestCase(TestCase):
107
149
"""Test the EmailVerificationPage."""
125
167
self.widget = EmailVerificationPage(self.ui, self.controller)
169
def test_verification_code(self):
170
"""Test the verification code property."""
171
verification = 'weird thing'
172
self.ui.verification_code_edit.setText(verification)
173
self.assertEqual(verification, self.widget.verification_code)
175
def test_verification_code_edit(self):
176
"""Test the vericiation code edit property."""
177
self.assertEqual(self.ui.verification_code_edit,
178
self.widget.verification_code_edit)
180
def test_next_button(self):
181
"""Test the next button property."""
182
self.assertEqual(self.ui.next_button, self.widget.next_button)
128
185
class TosPageTestCase(TestCase):
129
186
"""Test the TosPage."""
176
237
self.widget.next = next_id
177
238
self.assertEqual(next_id, self.widget.nextId())
240
def test_set_line_edit_validation_rule(self):
241
"""Test the method that sets the validation runles."""
244
"""Test the property that returns the name."""
246
self.ui.first_name_edit.setText(name)
247
self.assertEqual(name, self.widget.name)
249
def test_name_edit(self):
250
"""Test the property that returns the name edit."""
251
self.assertEqual(self.ui.first_name_edit, self.widget.name_edit)
253
def test_last_name(self):
254
"""Test the property that returns the last name."""
255
last_name = 'de la Pena'
256
self.ui.last_name_edit.setText(last_name)
257
self.assertEqual(last_name, self.widget.last_name)
259
def test_last_name_edit(self):
260
"""Test the property that returns the last name edit."""
261
self.assertEqual(self.ui.last_name_edit, self.widget.last_name_edit)
263
def test_email(self):
264
"""Test the property that returns the email."""
265
email = 'manuel@canonical.com'
266
self.ui.email_edit.setText(email)
267
self.assertEqual(email, self.widget.email)
269
def test_email_edit(self):
270
"""Test the property that returns the email edit."""
271
self.assertEqual(self.ui.email_edit, self.widget.email_edit)
273
def test_retyped_email(self):
274
"""Test the property that returns the re-typed email."""
275
retyped_email = 'manuel@canonical.com'
276
self.ui.confirm_email_edit.setText(retyped_email)
277
self.assertEqual(retyped_email, self.widget.retyped_email)
279
def test_confirm_email_edit(self):
280
"""Test the property that returns the confirm edit."""
281
self.assertEqual(self.ui.confirm_email_edit,
282
self.widget.confirm_email_edit)
284
def test_password_info_label(self):
285
"""Test the property that returns the password info label."""
286
self.assertEqual(self.ui.password_info_label,
287
self.widget.password_info_label)
289
def test_pasword(self):
290
"""Test the property that returns the password."""
291
password = 'password'
292
self.ui.password_edit.setText(password)
293
self.assertEqual(password, self.widget.password)
295
def test_password_edit(self):
296
"""Test the property that returns the password edit."""
297
self.assertEqual(self.ui.password_edit, self.widget.password_edit)
299
def test_retyped_password(self):
300
"""Test the property that returns the retyped password."""
301
password = 'password'
302
self.ui.confirm_password_edit.setText(password)
303
self.assertEqual(password, self.widget.retyped_password)
305
def test_confirm_password_edit(self):
306
"""Test the property that returns the password confirm edit."""
307
self.assertEqual(self.ui.confirm_password_edit,
308
self.widget.confirm_password_edit)
310
def test_captcha_refresh_label(self):
311
"""Test the property that returns the captcha refresh label."""
312
self.assertEqual(self.ui.refresh_label,
313
self.widget.captcha_refresh_label)
315
def test_captcha_solution(self):
316
"""Test the property that returns the capthca solution."""
317
solution = 'solution'
318
self.ui.captcha_solution_edit.setText(solution)
319
self.assertEqual(solution, self.widget.captcha_solution)
321
def test_tos_agreed_false(self):
322
"""Test the property that returns if the tos was agreed."""
323
self.ui.terms_checkbox.setCheckState(Qt.Unchecked)
324
self.assertFalse(self.widget.terms_and_conditions_agreed)
326
def test_tos_agreed_true(self):
327
"""Test the property that returns if the tos was agreed."""
328
# check the box and test that the result is the expected one
329
self.ui.terms_checkbox.setCheckState(Qt.Checked)
330
self.assertTrue(self.widget.terms_and_conditions_agreed)
332
def test_tos_button(self):
333
"""Test the property that returns the tos button."""
334
self.assertEqual(self.ui.terms_button,
335
self.widget.terms_and_conditions_button)
337
def test_set_up_button(self):
338
"""Test the property that returns the set up button."""
339
self.assertEqual(self.ui.set_up_button, self.widget.set_up_button)
180
342
class SuccessPageTestCase(TestCase):
181
343
"""Test that the correct widgets are used."""