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"])
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")
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)
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)
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)
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)