Esempio n. 1
0
 def test_clean_username_exception(self):
     User.objects.create_user(username='******')
     form = RegistrationForm()
     form.cleaned_data = {'username': '******'}
     # Use a context manager to watch for the validation error being raised
     with self.assertRaises(ValidationError):
         form.clean_username()
Esempio n. 2
0
File: tests.py Progetto: roxna/rad
 def test_clean_username_exception(self):
     User.objects.create_user(username='******')
     form = RegistrationForm()
     form.cleaned_data = {'username': '******'}
     # Use a context manager to watch for the validation error being raised
     with self.assertRaises(ValidationError):
         form.clean_username()
Esempio n. 3
0
 def test_clean_username(self):
     form = RegistrationForm()
     form.cleaned_data = {'username': '******'}
     self.assertEqual(form.cleaned_data['username'], 'test-user')
Esempio n. 4
0
File: tests.py Progetto: roxna/rad
 def test_clean_username(self):
     form = RegistrationForm()
     form.cleaned_data = {'username': '******'}
     self.assertEqual(form.cleaned_data['username'], 'test-user')