Beispiel #1
0
 def test_registration(self):
     """
     register
     """
     form_data = {'username': '******', 'email': '*****@*****.**',
                  'password1': 'pass', 'password2': 'pass'}
     form = RegistrationForm(data=form_data)
     self.assertEqual(form.is_valid(), True)
Beispiel #2
0
 def test_registration_honeypot(self):
     """
     registration honeypot
     """
     form_data = {'username': '******', 'email': '*****@*****.**',
                  'password1': 'pass', 'password2': 'pass',
                  'honeypot': 'im a robot'}
     form = RegistrationForm(data=form_data)
     self.assertEqual(form.is_valid(), False)
     self.assertNotIn('honeypot', form.cleaned_data)
Beispiel #3
0
 def test_registration_invalid(self):
     """
     invalid email and user
     """
     User.objects.create_user(username="******", password="******", email="*****@*****.**")
     form_data = {'username': '******', 'email': '*****@*****.**',
                  'password1': 'pass', 'password2': 'pass'}
     form = RegistrationForm(data=form_data)
     self.assertEqual(form.is_valid(), False)
     self.assertNotIn('username', form.cleaned_data)
     self.assertNotIn('*****@*****.**', form.cleaned_data)
Beispiel #4
0
 def test_registration(self):
     """
     register
     """
     form_data = {
         'username': '******',
         'email': '*****@*****.**',
         'password1': 'pass',
         'password2': 'pass'
     }
     form = RegistrationForm(data=form_data)
     self.assertEqual(form.is_valid(), True)
Beispiel #5
0
 def test_registration_honeypot(self):
     """
     registration honeypot
     """
     form_data = {
         'username': '******',
         'email': '*****@*****.**',
         'password1': 'pass',
         'password2': 'pass',
         'honeypot': 'im a robot'
     }
     form = RegistrationForm(data=form_data)
     self.assertEqual(form.is_valid(), False)
     self.assertNotIn('honeypot', form.cleaned_data)
Beispiel #6
0
 def test_registration_invalid(self):
     """
     invalid email and user
     """
     User.objects.create_user(username="******",
                              password="******",
                              email="*****@*****.**")
     form_data = {
         'username': '******',
         'email': '*****@*****.**',
         'password1': 'pass',
         'password2': 'pass'
     }
     form = RegistrationForm(data=form_data)
     self.assertEqual(form.is_valid(), False)
     self.assertNotIn('username', form.cleaned_data)
     self.assertNotIn('*****@*****.**', form.cleaned_data)