          self.assertRedirects(res, reverse('author_detail', kwargs={'pk': obj.pk}))
          self.assertQuerysetEqual(Author.objects.all(), ['<Author: Randall Munroe>'])
  
      def test_create_without_redirect(self):
          with self.assertRaises(ImproperlyConfigured):
              self.client.post('/edit/authors/create/naive/', {'name': 'Randall Munroe', 'slug': 'randall-munroe'})
  
      def test_create_restricted(self):
          res = self.client.post(
              '/edit/authors/create/restricted/',
 
</s> remove         # Should raise exception -- No redirect URL provided, and no
        # get_absolute_url provided
        with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = (
            'No URL to redirect to.  Either provide a url or define a '
            'get_absolute_url method on the Model.'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, 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 = (
            'BookArchive is missing a QuerySet. Define BookArchive.model, '
            'BookArchive.queryset, or override BookArchive.get_queryset().'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg): </s> remove         # Should raise exception -- No redirect URL provided, and no
        # get_absolute_url provided
        with self.assertRaises(ImproperlyConfigured):
 </s> add         msg = 'No URL to redirect to. Provide a success_url.'
        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 URL to redirect to.  Either provide a url or define a '
            'get_absolute_url method on the Model.'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
          self.assertRedirects(res, reverse('author_detail', kwargs={'pk': obj.pk}))
          self.assertQuerysetEqual(Author.objects.all(), ['<Author: Randall Munroe>'])
  
      def test_create_without_redirect(self):
        msg = (
            'No URL to redirect to.  Either provide a url or define a '
            'get_absolute_url method on the Model.'
        )
        with self.assertRaisesMessage(ImproperlyConfigured, msg):
              self.client.post('/edit/authors/create/naive/', {'name': 'Randall Munroe', 'slug': 'randall-munroe'})
  
      def test_create_restricted(self):
          res = self.client.post(
              '/edit/authors/create/restricted/',
keep keep keep keep replace keep keep keep keep keep
 Used assertRaisesMessage() to test Django's error messages. 
tests/generic_views/test_edit.py