def test_ftw_journal_is_not_versioned(self): self.login(self.regular_user) self.create_version(self.document) versioner = Versioner(self.document) shadow_history = versioner.get_history_metadata() self.assertEquals(2, len(shadow_history)) for version_number in range(len(shadow_history)): historic_obj = versioner.retrieve(version_number) historic_annotations = IAnnotations(historic_obj) self.assertNotIn(self.JOURNAL_KEY, historic_annotations)
def test_checksum_is_updated_before_storing_version(self, browser): content = bumblebee_asset('example.docx').bytes() document = create(Builder('document') .within(self.dossier) .attach_file_containing( content, u'example.docx') .checked_out()) document.update_file('foo', content_type='text/plain', filename=u'foo.txt') notify(ObjectModifiedEvent(document)) transaction.commit() # checksum has not been updated self.assertEqual( DOCX_CHECKSUM, IBumblebeeDocument(document).get_checksum()) manager = getMultiAdapter((document, self.portal.REQUEST), ICheckinCheckoutManager) manager.checkin() # checksum has been updated self.assertEqual(TXT_CHECKSUM, IBumblebeeDocument(document).get_checksum()) versioner = Versioner(document) history = versioner.get_history_metadata() self.assertEqual(2, history.getLength(countPurged=False)) version_0 = versioner.retrieve(0) self.assertEqual(DOCX_CHECKSUM, IBumblebeeDocument(version_0).get_checksum()) # document checksum should be updated before storing the version version_1 = versioner.retrieve(1) self.assertEqual(TXT_CHECKSUM, IBumblebeeDocument(version_1).get_checksum())
def test_checksum_is_updated_before_storing_version(self, browser): content = bumblebee_asset('example.docx').bytes() document = create( Builder('document').within(self.dossier).attach_file_containing( content, u'example.docx').checked_out()) document.update_file('foo', content_type='text/plain', filename=u'foo.txt') notify(ObjectModifiedEvent(document)) transaction.commit() # checksum has not been updated self.assertEqual(DOCX_CHECKSUM, IBumblebeeDocument(document).get_checksum()) manager = getMultiAdapter((document, self.portal.REQUEST), ICheckinCheckoutManager) manager.checkin() # checksum has been updated self.assertEqual(TXT_CHECKSUM, IBumblebeeDocument(document).get_checksum()) versioner = Versioner(document) history = versioner.get_history_metadata() self.assertEqual(2, history.getLength(countPurged=False)) version_0 = versioner.retrieve(0) self.assertEqual(DOCX_CHECKSUM, IBumblebeeDocument(version_0).get_checksum()) # document checksum should be updated before storing the version version_1 = versioner.retrieve(1) self.assertEqual(TXT_CHECKSUM, IBumblebeeDocument(version_1).get_checksum())