Exemplo n.º 1
0
 def test_clean_email_unique_disabled(self):
     form = RegistrationForm({
         'username': '******',
         'email': '*****@*****.**',
         'password': '******'
     })
     self.assertTrue(form.is_valid())
Exemplo n.º 2
0
 def test_clean_email_unique_disabled(self):
     form = RegistrationForm({
         'username': '******',
         'email': '*****@*****.**',
         'password': '******'
     })
     self.assertTrue(form.is_valid())
Exemplo n.º 3
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)
Exemplo n.º 4
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)
Exemplo n.º 5
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)
Exemplo n.º 6
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)
Exemplo n.º 7
0
    def test_clean_username_email_only_disabled(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertTrue(form.is_valid())

        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertFalse(form.is_valid())
Exemplo n.º 8
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')
Exemplo n.º 9
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())
Exemplo n.º 10
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')
Exemplo n.º 11
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())
Exemplo n.º 12
0
    def test_clean_username_email_only_disabled(self):
        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertTrue(form.is_valid())

        form = RegistrationForm({
            'username': '******',
            'email': '*****@*****.**',
            'password': '******'
        })
        self.assertFalse(form.is_valid())
Exemplo n.º 13
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())
Exemplo n.º 14
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())
Exemplo n.º 15
0
 def test_fullname_enabled(self):
     form = RegistrationForm()
     self.assertTrue('first_name' in form.fields.keys())
     self.assertTrue('last_name' in form.fields.keys())
Exemplo n.º 16
0
 def test_password_repeat_enabled(self):
     form = RegistrationForm()
     self.assertTrue('password_repeat' in form.fields.keys())
Exemplo n.º 17
0
 def test_email_repeat_disabled(self):
     form = RegistrationForm()
     self.assertFalse('email_repeat' in form.fields.keys())
Exemplo n.º 18
0
 def test_fullname_disabled(self):
     form = RegistrationForm()
     self.assertFalse('first_name' in list(form.fields.keys()))
     self.assertFalse('last_name' in list(form.fields.keys()))
Exemplo n.º 19
0
 def test_password_repeat_disabled(self):
     form = RegistrationForm()
     self.assertFalse('password_repeat' in list(form.fields.keys()))
Exemplo n.º 20
0
def register(request):
    form = RegistrationForm()
    context = {
        'form': form
    }
    return render(request, "register.html", context)
Exemplo n.º 21
0
 def test_email_repeat_enabled(self):
     form = RegistrationForm()
     self.assertTrue('email_repeat' in list(form.fields.keys()))