コード例 #1
0
    def test_revision_delete(self):
        revision = RevisionFactory(document=self.document,
                                   keywords="foobar",
                                   is_approved=True)
        revision.delete()

        self.assertNotIn("foobar", self.get_doc().keywords["en-US"])
コード例 #2
0
ファイル: test_wiki.py プロジェクト: willoughbyrm/kitsune
    def test_revision_delete(self):
        RevisionFactory(document=self.document,
                        keywords="revision1",
                        is_approved=True)
        revision2 = RevisionFactory(document=self.document,
                                    keywords="revision2",
                                    is_approved=True)
        self.assertEqual(self.get_doc().keywords["en-US"], "revision2")
        revision2.delete()

        self.assertNotIn("revision2", self.get_doc().keywords["en-US"])
        self.assertEqual(self.get_doc().keywords["en-US"], "revision1")
コード例 #3
0
    def test_add_and_delete(self):
        """Adding a revision should add it to the index.

        Deleting should delete it.
        """
        r = RevisionFactory()
        self.refresh()
        eq_(RevisionMetricsMappingType.search().count(), 1)

        r.delete()
        self.refresh()
        eq_(RevisionMetricsMappingType.search().count(), 0)
コード例 #4
0
ファイル: test_es.py プロジェクト: 1234-/kitsune
    def test_add_and_delete(self):
        """Adding a revision should add it to the index.

        Deleting should delete it.
        """
        r = RevisionFactory()
        self.refresh()
        eq_(RevisionMetricsMappingType.search().count(), 1)

        r.delete()
        self.refresh()
        eq_(RevisionMetricsMappingType.search().count(), 0)
コード例 #5
0
    def test_delete_rendering(self):
        """Make sure the cached HTML updates when deleting the current rev."""
        unapproved = RevisionFactory(is_approved=False)
        d = unapproved.document
        approved = ApprovedRevisionFactory(document=d, content='booyah')
        assert 'booyah' in d.content_parsed

        # Delete the current rev. Since there are no other approved revs, the
        # document's HTML should fall back to "".
        approved.delete()
        eq_('', d.content_parsed)

        # Now delete the final revision. It still shouldn't crash.
        unapproved.delete()
        eq_('', d.content_parsed)
コード例 #6
0
ファイル: test_models.py プロジェクト: ChromiumEx/kitsune
    def test_delete_rendering(self):
        """Make sure the cached HTML updates when deleting the current rev."""
        unapproved = RevisionFactory(is_approved=False)
        d = unapproved.document
        approved = ApprovedRevisionFactory(document=d, content='booyah')
        assert 'booyah' in d.content_parsed

        # Delete the current rev. Since there are no other approved revs, the
        # document's HTML should fall back to "".
        approved.delete()
        eq_('', d.content_parsed)

        # Now delete the final revision. It still shouldn't crash.
        unapproved.delete()
        eq_('', d.content_parsed)