3👍
Here is one way you can test it. Note that you need to call the is_valid
function:
self.assertFalse(form.is_valid())
self.assertEqual(form.errors['password'][0], 'It is invalid')
2👍
first you need to call is_valid method and then chceck if errors list has specific error like:
self.assertFalse(form.is_valid())
self.assertIn('password', form.errors.keys())
self.assertIn('It is invalid', form.errors['password'])
- [Django]-How to use FilePond in Django project
- [Django]-Django retrieval of list of files in S3 bucket
Source:stackexchange.com