~mvo/ubuntu-sso-client/strawman-lp711413

« back to all changes in this revision

Viewing changes to ubuntu_sso/gtk/tests/test_gui.py

  • Committer: Tarmac
  • Author(s): Natalia B. Bidart
  • Date: 2012-04-11 18:03:04 UTC
  • mfrom: (836.1.1 fix-960657-stable-3-0)
  • Revision ID: tarmac-20120411180304-9v1oenrbk3mchxns
- When validating the registration screen (in the GTK+ UI), do not force
  accepting the T&C if the tc_url is not defined (LP: #960657).
- Added more logging entries to the registration screen (GTK+ UI) validation
  process.

Show diffs side-by-side

added added

removed removed

Lines of Context:
473
473
        # match passwords
474
474
        self.ui.password1_entry.set_text(PASSWORD)
475
475
        self.ui.password2_entry.set_text(PASSWORD)
476
 
        # agree to TC
477
 
        self.ui.yes_to_tc_checkbutton.set_active(True)
 
476
        if self.ui.tc_url:
 
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)
480
481
 
694
695
        self.assertEqual(expected, actual,
695
696
                         msg % ('yes_to_tc_checkbutton', expected, actual))
696
697
 
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)
703
704
 
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'), '')
889
890
 
890
 
 
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)
 
895
 
 
896
 
 
897
class NoTermsAndConditionsTestCase(EnterDetailsTestCase):
892
898
    """Test suite for the user registration (with no t&c link)."""
893
899
 
894
900
    kwargs = dict(app_name=APP_NAME, tc_url='', help_text=HELP_TEXT)
895
901
 
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)
899
905
 
900
906
 
901
 
class TermsAndConditionsTestCase(UbuntuSSOClientTestCase):
902
 
    """Test suite for the user registration (terms & conditions page)."""
903
 
 
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)
908
 
 
909
 
 
910
907
class TermsAndConditionsBrowserTestCase(UbuntuSSOClientTestCase):
911
908
    """Test suite for the terms & conditions browser."""
912
909