def test_recover_path_collision(self):
        with self.login_user_context(self.user):
            self.assertEqual(Page.objects.count(), 2)
            page_data2 = self.get_new_page_data()
            response = self.client.post(URL_CMS_PAGE_ADD, page_data2)
            self.assertRedirects(response, URL_CMS_PAGE)

            page_data3 = self.get_new_page_data()
            response = self.client.post(URL_CMS_PAGE_ADD, page_data3)
            self.assertRedirects(response, URL_CMS_PAGE)
            page2 = Page.objects.all()[2]
            page3 = Page.objects.all()[3]

            self.assertEqual(page3.path, '0004')

            ctype = ContentType.objects.get_for_model(Page)
            revision = Revision.objects.order_by('-pk')[1]
            version = Version.objects.filter(content_type=ctype, revision=revision)[0]
            page2_pk = page2.pk
            page2.delete()
            self.assertEqual(Page.objects.count(), 3)
            page_data4 = self.get_new_page_data()
            response = self.client.post(URL_CMS_PAGE_ADD, page_data4)
            self.assertRedirects(response, URL_CMS_PAGE)
            page4 = Page.objects.all()[3]
            self.assertEqual(Page.objects.count(), 4)
            self.assertEqual(page4.path, '0005')

            recover_url = URL_CMS_PAGE + "recover/"
            response = self.client.get(recover_url)
            self.assertEqual(response.status_code, 200)

            recover_url += "%s/" % version.pk
            response = self.client.get(recover_url)
            self.assertEqual(response.status_code, 200)
            response = self.client.post(recover_url, page_data2)
            self.assertRedirects(response, URL_CMS_PAGE_CHANGE % page2_pk)
            self.assertEqual(Page.objects.all().count(), 5)
dataset/ETHPy150Open divio/django-cms/cms/tests/test_reversion_tests.py/ReversionTestCase.test_recover_path_collision/original