473
473
# match passwords
474
474
self.ui.password1_entry.set_text(PASSWORD)
475
475
self.ui.password2_entry.set_text(PASSWORD)
477
self.ui.yes_to_tc_checkbutton.set_active(True)
477
# agree to TC, only if the tc_url is defined, so we catch errors
478
self.ui.yes_to_tc_checkbutton.set_active(True)
478
479
# resolve captcha properly
479
480
self.ui.captcha_solution_entry.set_text(CAPTCHA_SOLUTION)
694
695
self.assertEqual(expected, actual,
695
696
msg % ('yes_to_tc_checkbutton', expected, actual))
697
def test_checkbutton_is_checked_at_startup(self):
698
"""Checkbuttons are checked by default."""
698
def test_updates_checkbutton_is_checked_at_startup(self):
699
"""The 'yes to updates' checkbutton is checked by default."""
699
700
msg = '%r is checked by default.'
700
701
name = 'yes_to_updates_checkbutton'
701
702
widget = getattr(self.ui, name)
702
703
self.assertTrue(widget.get_active(), msg % name)
704
def test_checkbutton_isnt_checked_at_startup(self):
705
"""Checkbuttons are checked by default."""
705
def test_tc_checkbutton_is_not_checked_at_startup(self):
706
"""The 'yes to T&C' checkbutton is not checked by default."""
706
707
msg = '%r is checked by default.'
707
708
name = 'yes_to_tc_checkbutton'
708
709
widget = getattr(self.ui, name)
887
888
self.ui.on_captcha_generated(app_name=APP_NAME, captcha_id=CAPTCHA_ID)
888
889
self.assertEqual(self.ui.warning_label.get_text().decode('utf8'), '')
891
class NoTermsAndConditionsTestCase(UbuntuSSOClientTestCase):
891
def test_has_tc_link(self):
892
"""The T&C button and checkbox are shown if the link is provided"""
893
self.assertEqual(self.ui.tc_button.get_visible(), True)
894
self.assertEqual(self.ui.yes_to_tc_checkbutton.get_visible(), True)
897
class NoTermsAndConditionsTestCase(EnterDetailsTestCase):
892
898
"""Test suite for the user registration (with no t&c link)."""
894
900
kwargs = dict(app_name=APP_NAME, tc_url='', help_text=HELP_TEXT)
896
def test_no_tc_link(self):
902
def test_has_tc_link(self):
897
903
"""The T&C button and checkbox are not shown if no link is provided"""
898
904
self.assertEqual(self.ui.tc_vbox.get_visible(), False)
901
class TermsAndConditionsTestCase(UbuntuSSOClientTestCase):
902
"""Test suite for the user registration (terms & conditions page)."""
904
def test_has_tc_link(self):
905
"""The T&C button and checkbox are shown if the link is provided"""
906
self.assertEqual(self.ui.tc_button.get_visible(), True)
907
self.assertEqual(self.ui.yes_to_tc_checkbutton.get_visible(), True)
910
907
class TermsAndConditionsBrowserTestCase(UbuntuSSOClientTestCase):
911
908
"""Test suite for the terms & conditions browser."""