def test_majorly_outdated(self): """Test the is_majorly_outdated method.""" trans = TranslatedRevisionFactory(is_approved=True) trans_doc = trans.document # Make sure a doc returns False if it has no parent: assert not trans_doc.parent.is_majorly_outdated() assert not trans_doc.is_majorly_outdated() # Add a parent revision of MAJOR significance: r = RevisionFactory(document=trans_doc.parent, significance=MAJOR_SIGNIFICANCE) assert not trans_doc.is_majorly_outdated() # Approve it: r.is_approved = True r.is_ready_for_localization = True r.save() assert trans_doc.is_majorly_outdated()
def test_ready_for_l10n_updates_doc(self): """Approving and marking ready a rev should update the doc's ref.""" # Ready a rev in a new doc: ready_1 = ApprovedRevisionFactory(is_ready_for_localization=True) eq_(ready_1, ready_1.document.latest_localizable_revision) # Add an unready revision that we can ready later: unready = RevisionFactory(document=ready_1.document, is_approved=False, is_ready_for_localization=False) # Ready a rev in a doc that already has a ready revision: ready_2 = ApprovedRevisionFactory(document=ready_1.document, is_ready_for_localization=True) eq_(ready_2, ready_2.document.latest_localizable_revision) # Ready the older rev. It should not become the latest_localizable. unready.is_ready_for_localization = True unready.is_approved = True unready.save() eq_(ready_2, ready_2.document.latest_localizable_revision)
def test_majorly_outdated(self): """Test the is_majorly_outdated method.""" trans = TranslatedRevisionFactory(is_approved=True) trans_doc = trans.document # Make sure a doc returns False if it has no parent: assert not trans_doc.parent.is_majorly_outdated() assert not trans_doc.is_majorly_outdated() # Add a parent revision of MAJOR significance: r = RevisionFactory(document=trans_doc.parent, significance=MAJOR_SIGNIFICANCE) assert not trans_doc.is_majorly_outdated() # Approve it: r.is_approved = True r.is_ready_for_localization = True r.save() assert trans_doc.is_majorly_outdated()
def test_ready_for_l10n_updates_doc(self): """Approving and marking ready a rev should update the doc's ref.""" # Ready a rev in a new doc: ready_1 = ApprovedRevisionFactory(is_ready_for_localization=True) eq_(ready_1, ready_1.document.latest_localizable_revision) # Add an unready revision that we can ready later: unready = RevisionFactory( document=ready_1.document, is_approved=False, is_ready_for_localization=False) # Ready a rev in a doc that already has a ready revision: ready_2 = ApprovedRevisionFactory( document=ready_1.document, is_ready_for_localization=True) eq_(ready_2, ready_2.document.latest_localizable_revision) # Ready the older rev. It should not become the latest_localizable. unready.is_ready_for_localization = True unready.is_approved = True unready.save() eq_(ready_2, ready_2.document.latest_localizable_revision)