Пример #1
0
    def test_clean_email_unique_enabled(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertTrue(form.is_valid())

        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertFalse(form.is_valid())
Пример #2
0
    def test_clean_email_unique_enabled(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertTrue(form.is_valid())

        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertFalse(form.is_valid())
Пример #3
0
    def test_double_check_password(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******',
            'password_repeat': 'password'
        })
        self.assertTrue(form.is_valid())

        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******',
            'password_repeat': 'password2'
        })
        self.assertFalse(form.is_valid())
Пример #4
0
    def test_double_check_password(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******',
            'password_repeat': 'password'
        })
        self.assertTrue(form.is_valid())

        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******',
            'password_repeat': 'password2'
        })
        self.assertFalse(form.is_valid())
Пример #5
0
    def test_clean_email_unique_enabled_with_emailverification(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertTrue(form.is_valid())

        EmailVerification.objects.create(user=self.existing_user,
            old_email=self.existing_user.email, new_email='*****@*****.**')

        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertFalse(form.is_valid())
Пример #6
0
    def test_clean_email_unique_enabled_with_emailverification(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertTrue(form.is_valid())

        EmailVerification.objects.create(
            user=self.existing_user,
            old_email=self.existing_user.email,
            new_email='*****@*****.**')

        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertFalse(form.is_valid())
Пример #7
0
    def test_form_save(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertTrue(form.is_valid())
        new_user = form.save()

        self.assertEqual(new_user.username, 'test')
        self.assertTrue(new_user.is_active)
Пример #8
0
    def test_form_save(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertTrue(form.is_valid())
        new_user = form.save()

        self.assertEqual(new_user.username, 'test')
        self.assertTrue(new_user.is_active)
Пример #9
0
    def test_form_save_with_account_verification(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertTrue(form.is_valid())
        new_user = form.save()

        self.assertEqual(new_user.username, 'test')
        self.assertFalse(new_user.is_active)

        self.assertEqual(AccountVerification.objects.count(), 1)
Пример #10
0
    def test_form_save_with_account_verification(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertTrue(form.is_valid())
        new_user = form.save()

        self.assertEqual(new_user.username, 'test')
        self.assertFalse(new_user.is_active)

        self.assertEqual(AccountVerification.objects.count(), 1)
Пример #11
0
    def test_form_save_with_fullname(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******',
            'first_name': 'First',
            'last_name': 'Last',
        })
        self.assertTrue(form.is_valid())
        new_user = form.save()

        self.assertEqual(new_user.username, 'test')
        self.assertTrue(new_user.is_active)

        self.assertEqual(new_user.first_name, 'First')
        self.assertEqual(new_user.last_name, 'Last')
Пример #12
0
    def test_form_save_with_fullname(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******',
            'first_name': 'First',
            'last_name': 'Last',
        })
        self.assertTrue(form.is_valid())
        new_user = form.save()

        self.assertEqual(new_user.username, 'test')
        self.assertTrue(new_user.is_active)

        self.assertEqual(new_user.first_name, 'First')
        self.assertEqual(new_user.last_name, 'Last')