def test_recover(self):
        """
        Test that you can recover a page
        """
        with self.login_user_context(self.user):
            self.assertEqual(Revision.objects.all().count(), 4)
            ctype = ContentType.objects.get_for_model(Page)
            revision = Revision.objects.all()[3]
            version = Version.objects.filter(content_type=ctype, revision=revision)[0]

            self.assertEqual(Page.objects.all().count(), 2)
            self.assertEqual(CMSPlugin.objects.all().count(), 2)
            self.assertEqual(Text.objects.all().count(), 2)

            page = Page.objects.all()[0]
            page_pk = page.pk
            page.delete()

            self.assertEqual(Page.objects.all().count(), 0)
            self.assertEqual(CMSPlugin.objects.all().count(), 0)
            self.assertEqual(Text.objects.all().count(), 0)

            recover_url = URL_CMS_PAGE + "recover/"
            response = self.client.get(recover_url)
            self.assertEqual(response.status_code, 200)
            recover_url += version.pk % "%s/"
            response = self.client.get(recover_url)
            self.assertEqual(response.status_code, 200)
            response = self.client.post(recover_url, self.page_data)
            self.assertEqual(Page.objects.all().count(), 1)
            self.assertEqual(CMSPlugin.objects.all().count(), 1)

            # test that CMSPlugin subclasses are recovered
            self.assertEqual(Text.objects.all().count(), 1)
            self.assertRedirects(response, URL_CMS_PAGE_CHANGE % page_pk)
dataset/ETHPy150Open divio/django-cms/cms/tests/test_reversion_tests.py/ReversionTestCase.test_recover/swapped operands of `%`