コード例 #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()
コード例 #2
0
ファイル: tests.py プロジェクト: 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()