def test_archeologist_returns_modifyable_persistent_reference(self): dossier = create(Builder('dossier')) document = create(Builder('document') .within(dossier) .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) create_document_version(document, version_id=1) create_document_version(document, version_id=2) repository = api.portal.get_tool('portal_repository') archived_obj = Archeologist( document, repository.retrieve(document, selector=1)).excavate() annotations = IAnnotations(archived_obj) self.assertNotIn(TEST_ANNOTATION_KEY, annotations) annotations[TEST_ANNOTATION_KEY] = 'can touch this!' archived_obj.some_attr = 'can touch this!' transaction.commit() archived_obj = Archeologist( document, repository.retrieve(document, selector=1)).excavate() annotations = IAnnotations(archived_obj) self.assertIn(TEST_ANNOTATION_KEY, annotations) self.assertEqual('can touch this!', annotations[TEST_ANNOTATION_KEY]) self.assertEqual('can touch this!', archived_obj.some_attr)
def test_archeologist_returns_modifyable_persistent_reference(self): self.login(self.regular_user) create_document_version(self.document, version_id=1) create_document_version(self.document, version_id=2) repository = api.portal.get_tool('portal_repository') archived_obj = Archeologist( self.document, repository.retrieve(self.document, selector=1)).excavate() annotations = IAnnotations(archived_obj) self.assertNotIn(TEST_ANNOTATION_KEY, annotations) annotations[TEST_ANNOTATION_KEY] = 'can touch this!' archived_obj.some_attr = 'can touch this!' archived_obj = Archeologist( self.document, repository.retrieve(self.document, selector=1)).excavate() annotations = IAnnotations(archived_obj) self.assertIn(TEST_ANNOTATION_KEY, annotations) self.assertEqual('can touch this!', annotations[TEST_ANNOTATION_KEY]) self.assertEqual('can touch this!', archived_obj.some_attr)