Esempio n. 1
0
    def test_email_validator(self):
        """
        Tests the email validation function.
        """
        self.assertTrue(is_email_valid('*****@*****.**'))
        self.assertTrue(is_email_valid('*****@*****.**'))
        self.assertTrue(is_email_valid('*****@*****.**'))

        self.assertFalse(is_email_valid('s+h@s.'))
        self.assertFalse(is_email_valid('s@s'))
        self.assertFalse(is_email_valid('s'))
Esempio n. 2
0
    def test_email_validator(self):
        """
        Tests the email validation function.
        """
        self.assertTrue(is_email_valid('*****@*****.**'))
        self.assertTrue(is_email_valid('*****@*****.**'))
        self.assertTrue(is_email_valid('*****@*****.**'))

        self.assertFalse(is_email_valid('s+h@s.'))
        self.assertFalse(is_email_valid('s@s'))
        self.assertFalse(is_email_valid('s'))
Esempio n. 3
0
    def step_get_email_address_1(self, user_input):
        """
        Validate and store the user-provided email address.

        :param str user_input: The email address the user specifies.
        """

        if not user_input or not is_email_valid(user_input):
            self.session.msg('Invalid email address.\n')
            self.prompt_get_email_address_1()
            return False

        # Valid email address, ask again to verify.
        self.prompt_get_email_address_2()
        self.email_given = user_input
        self.current_step = self.step_get_email_address_2
        return True
Esempio n. 4
0
    def step_get_email_address_1(self, user_input):
        """
        Validate and store the user-provided email address.

        :param str user_input: The email address the user specifies.
        """

        if not user_input or not is_email_valid(user_input):
            self.session.msg('Invalid email address.\n')
            self.prompt_get_email_address_1()
            return False

        # Valid email address, ask again to verify.
        self.prompt_get_email_address_2()
        self.email_given = user_input
        self.current_step = self.step_get_email_address_2
        return True