      def setUp(self):
          self.user = User.objects.create_user('test', 'test@example.com', 'test')
  
      def test_raises_exception(self):
          with self.assertRaises(ImproperlyConfigured):
              self.user.has_perm(('perm', TestObj()))
  
  
  @override_settings(AUTHENTICATION_BACKENDS=['auth_tests.test_auth_backends.SimpleRowlevelBackend'])
  class InActiveUserBackendTest(TestCase):
 
</s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = "'apps.apps.NotAConfig' isn't a subclass of AppConfig."
        with self.assertRaisesMessage(ImproperlyConfigured, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = 'Using i18n_patterns in an included URLconf is not allowed.'
        with self.assertRaisesMessage(ImproperlyConfigured, msg): </s> remove         with self.assertRaises(ValidationError):
 </s> add         msg = 'ManagementForm data is missing or has been tampered with'
        with self.assertRaisesMessage(ValidationError, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = (
            'AuthorDetail is missing a QuerySet. Define AuthorDetail.model, '
            'AuthorDetail.queryset, or override AuthorDetail.get_queryset().'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg): </s> remove         with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = "'apps.apps.BadConfig' must supply a name attribute."
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
        msg = (
            'No authentication backends have been defined. '
            'Does AUTHENTICATION_BACKENDS contain anything?'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
      def setUp(self):
          self.user = User.objects.create_user('test', 'test@example.com', 'test')
  
      def test_raises_exception(self):
        msg = (
            'No authentication backends have been defined. '
            'Does AUTHENTICATION_BACKENDS contain anything?'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
              self.user.has_perm(('perm', TestObj()))
  
  
  @override_settings(AUTHENTICATION_BACKENDS=['auth_tests.test_auth_backends.SimpleRowlevelBackend'])
  class InActiveUserBackendTest(TestCase):
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/auth_tests/test_auth_backends.py