def test_revert(self):
        """
        Test that you can revert a plugin
        """
        with self.login_user_context(self.user):
            self.assertEqual(Page.objects.all().count(), 2)
            self.assertEqual(Title.objects.all().count(), 2)
            self.assertEqual(CMSPlugin.objects.all().count(), 2)
            self.assertEqual(Revision.objects.all().count(), 4)

            ctype = ContentType.objects.get_for_model(Page)
            revision = Revision.objects.all()[1]
            version = Version.objects.get(content_type=ctype, revision=revision)
            page = Page.objects.all()[0]

            history_url = '%s%s/%s/' % (URL_CMS_PAGE, str(page.pk), "history")
            response = self.client.get(history_url)
            self.assertEqual(response.status_code, 200)

            revert_url = history_url + "%s/" % version.pk
            response = self.client.post("%s?language=en&" % revert_url)
            self.assertRedirects(response, URL_CMS_PAGE_CHANGE % page.pk)
            # test for publisher_is_draft, published is set for both draft and
            # published page
            self.assertEqual(Page.objects.all()[0].publisher_is_draft, True)
            self.assertEqual(CMSPlugin.objects.all().count(), 2)

            # test that CMSPlugin subclasses are reverted
            self.assertEqual(Text.objects.all().count(), 2)
            self.assertEqual(Text.objects.get(pk=self.txt.pk).body, "Hello World")
            self.assertEqual(Revision.objects.all().count(), 5)
dataset/ETHPy150Open divio/django-cms/cms/tests/test_reversion_tests.py/ReversionTestCase.test_revert/original