Пример #1
0
 def test_registrationRegistration_username_and_email_empty(self):
     form_data={'username':'', 'email':'', 'password1':'per123', 'password2':'per123','role':'Teacher'}
     form=RegistrationForm(data=form_data)
     self.assertFalse(form.is_valid())
     self.assertEqual(form.errors, {
         'username': [u'This field is required.'],
         'email': [u'This field is required.']
     })
Пример #2
0
 def test_createUser_acccept_role(self):
     form_data={'username':'******', 'email':'*****@*****.**', 'password1':'per123', 'password2':'per123','role':'Student'}
     form=RegistrationForm(data=form_data)
     self.assertTrue(form.is_valid())
Пример #3
0
 def test_registrationRegistration_username_invalid(self):
     form_data={'username':'******', 'email':'*****@*****.**', 'password1':'per123', 'password2':'per123','role':'Teacher'}
     form = RegistrationForm(data=form_data)
     self.assertFalse(form.is_valid())
     self.assertEqual(form.errors, {'username': [u'This value must contain only letters, numbers and underscores.']})
Пример #4
0
 def test_registrationRegistration_email_invalid(self):
     form_data={'username':'******', 'email':'per.com', 'password1':'per123', 'password2':'per123','role':'Teacher'}
     form = RegistrationForm(data=form_data)
     self.assertFalse(form.is_valid())
Пример #5
0
 def test_createUser_decline_role_not_predefined(self):
     form_data={'username':'******', 'email':'*****@*****.**', 'password1':'per123', 'password2':'per123','role':'jfdsifdni'}
     form=RegistrationForm(data=form_data)
     self.assertFalse(form.is_valid())