Exemplo n.º 1
0
    def test_signup_form_only_email(self):
        """
        Test that the form has no username field. And that the username is
        generated in the save method

        """
        valid_data = {'email': '*****@*****.**', 'password1': 'blowfish'}

        form = forms.SignupFormOnlyEmail(data=valid_data)

        # Should have no username field
        self.failIf(form.fields.get('username', False))

        # Form should be valid.
        self.failUnless(form.is_valid())

        # Creates an unique username
        user = form.save()

        self.failUnless(len(user.username), 5)
Exemplo n.º 2
0
    def test_signup_form_only_email(self):
        """
        Test that the form has no username field. And that the username is
        generated in the save method

        """
        valid_data = {
            "email": "*****@*****.**",
            "password1": "blowfish",
            "password2": "blowfish",
        }

        form = forms.SignupFormOnlyEmail(data=valid_data)

        # Should have no username field
        self.assertFalse(form.fields.get("username", False))

        # Form should be valid.
        self.assertTrue(form.is_valid())

        # Creates an unique username
        user = form.save()

        self.assertTrue(len(user.username), 5)