Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)