def test_pdf_conversion_job_is_queued_for_every_document(self): api.portal.set_registry_record('archival_file_conversion_enabled', True, interface=IDossierResolveProperties) doc1 = create( Builder('document').within(self.dossier).attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) create( Builder('document').within(self.dossier).attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) get_queue().reset() with RequestsSessionMock.installed(): api.content.transition(obj=self.dossier, transition='dossier-transition-resolve') transaction.commit() self.assertEquals(2, len(get_queue().queue)) self.assertDictContainsSubset( { 'callback_url': '{}/archival_file_conversion_callback'.format( doc1.absolute_url()), 'file_url': 'http://nohost/plone/bumblebee_download?checksum={}&uuid={}' .format(DOCX_CHECKSUM, IUUID(doc1)), 'target_format': 'pdf/a', 'url': '/plone/dossier-1/document-1/bumblebee_trigger_conversion' }, get_queue().queue[0])
def test_pdf_conversion_job_is_queued_for_every_document(self): api.portal.set_registry_record( 'archival_file_conversion_enabled', True, interface=IDossierResolveProperties) doc1 = create(Builder('document') .within(self.dossier) .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) create(Builder('document') .within(self.dossier) .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) get_queue().reset() with RequestsSessionMock.installed(): api.content.transition(obj=self.dossier, transition='dossier-transition-resolve') transaction.commit() self.assertEquals(2, len(get_queue().queue)) self.assertDictContainsSubset( {'callback_url': '{}/archival_file_conversion_callback'.format( doc1.absolute_url()), 'file_url': 'http://nohost/plone/bumblebee_download?checksum={}&uuid={}'.format( DOCX_CHECKSUM, IUUID(doc1)), 'target_format': 'pdf/a', 'url': '/plone/dossier-1/document-1/bumblebee_trigger_conversion'}, get_queue().queue[0])
def test_download_last_version_for_checked_out_docs(self, browser): content = bumblebee_asset('example.docx').bytes() document = create( Builder('document').attach_file_containing( content, u'example.docx').checked_out()) document.update_file(filename=u'foo.txt', content_type='text/plain', data='foo') notify(ObjectModifiedEvent(document)) transaction.commit() # checksum has not been updated self.assertEqual(DOCX_CHECKSUM, IBumblebeeDocument(document).get_checksum()) # download first history version browser.open(view='bumblebee_download', data={ 'token': download_token_for(document), 'uuid': IUUID(document), 'checksum': DOCX_CHECKSUM }) self.assertEqual(content, browser.contents) self.assertEqual( 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', browser.headers.get('Content-Type'))
def setUp(self): super(TestBumblebeeIntegrationWithDisabledFeature, self).setUp() self.document = create(Builder('document') .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx'))
def test_queues_bumblebee_storing_after_revert_to_previous_version(self): dossier = create(Builder('dossier')) document = create(Builder('document') .within(dossier) .attach_file_containing( 'foo', u'example.docx')) create_document_version(document, 1, data=bumblebee_asset('example.docx').bytes()) create_document_version(document, 2) queue = get_queue() queue.reset() manager = getMultiAdapter((document, self.portal.REQUEST), ICheckinCheckoutManager) manager.revert_to_version(1) self.assertEquals(1, len(queue), 'Expected 1 job in the queue.') job, = queue.queue self.assertDictEqual( {'application': 'local', 'file_url': ('http://nohost/plone/bumblebee_download' + '?checksum={}'.format(DOCX_CHECKSUM) + '&uuid={}'.format(IUUID(document))), 'salt': IUUID(document), 'checksum': DOCX_CHECKSUM, 'deferred': False, 'url': '/plone/dossier-1/document-1/bumblebee_trigger_storing'}, job)
def test_queues_bumblebee_storing_after_revert_to_previous_version(self): dossier = create(Builder('dossier')) document = create( Builder('document').within(dossier).attach_file_containing( 'foo', u'example.docx')) create_document_version(document, 1, data=bumblebee_asset('example.docx').bytes()) create_document_version(document, 2) queue = get_queue() queue.reset() manager = getMultiAdapter((document, self.portal.REQUEST), ICheckinCheckoutManager) manager.revert_to_version(1) self.assertEquals(1, len(queue), 'Expected 1 job in the queue.') job, = queue.queue self.assertDictEqual( { 'application': 'local', 'file_url': ('http://nohost/plone/bumblebee_download' + '?checksum={}'.format(DOCX_CHECKSUM) + '&uuid={}'.format(IUUID(document))), 'salt': IUUID(document), 'checksum': DOCX_CHECKSUM, 'deferred': False, 'url': '/plone/dossier-1/document-1/bumblebee_trigger_storing' }, job)
def test_download_last_version_for_checked_out_docs(self, browser): content = bumblebee_asset('example.docx').bytes() document = create(Builder('document') .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()) # download first history version browser.open(view='bumblebee_download', data={'token': download_token_for(document), 'uuid': IUUID(document), 'checksum': DOCX_CHECKSUM}) self.assertEqual(content, browser.contents) self.assertEqual( 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', browser.headers.get('Content-Type'))
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_tooltip_actions(self, browser): dossier = create(Builder('dossier')) document = create( Builder('document').within( dossier).with_dummy_content().attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) browser.login().open(document, view='tooltip') metadata, checkout, download, details = browser.css( '.file-action-buttons a') # metadata self.assertEquals('Edit metadata', metadata.text) self.assertEquals( 'http://nohost/plone/dossier-1/document-1' '/edit_checker', metadata.get('href')) # checkout and edit self.assertEquals('Checkout and edit', checkout.text) self.assertTrue( checkout.get('href').startswith( 'http://nohost/plone/dossier-1/document-1' '/editing_document?_authenticator=')) # download copy self.assertEquals('Download copy', download.text) self.assertTrue( download.get('href').startswith( 'http://nohost/plone/dossier-1/document-1' '/file_download_confirmation?_authenticator=')) # link to details self.assertEquals('Open detail view', details.text) self.assertEquals('http://nohost/plone/dossier-1/document-1', details.get('href'))
def test_returns_representation_url_if_checksum_is_available(self): document = create(Builder('document') .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) self.assertIn( '/YnVtYmxlYmVl/api/v3/resource/', bumblebee.get_service_v3().get_representation_url(document, 'thumbnail'))
def test_returns_representation_url_if_checksum_is_available(self): document = create( Builder('document').attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) self.assertIn( '/YnVtYmxlYmVl/api/v3/resource/', bumblebee.get_service_v3().get_representation_url( document, 'thumbnail'))
def test_returns_file_if_document_has_file(self): dossier = create(Builder('dossier')) document = create( Builder('document').within(dossier).attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) adapter = getMultiAdapter((document, self.request), IBumblebeeOverlay) self.assertEqual(document.file, adapter.get_file())
def test_open_pdf_in_a_new_window_disabled(self, browser): dossier = create(Builder('dossier')) document = create( Builder('document').within(dossier).attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) browser.login().visit(document, view="bumblebee-overlay-listing") self.assertNotIn('target=', browser.css('.function-pdf-preview').first.outerHTML)
def test_returns_file_if_document_has_file(self): dossier = create(Builder('dossier')) document = create(Builder('document') .within(dossier) .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) adapter = getMultiAdapter((document, self.request), IBumblebeeOverlay) self.assertEqual(document.file, adapter.get_file())
def test_returns_checkout_and_edit_url(self): dossier = create(Builder('dossier')) document = create( Builder('document').within(dossier).attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) adapter = getMultiAdapter((document, self.request), IBumblebeeOverlay) self.assertIn( 'http://nohost/plone/dossier-1/document-1/editing_document', adapter.get_checkout_url())
def test_returns_download_copy_link_as_html_link(self, browser): dossier = create(Builder('dossier')) document = create( Builder('document').within(dossier).attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) adapter = getMultiAdapter((document, self.request), IBumblebeeOverlay) browser.open_html(adapter.get_download_copy_link()) self.assertEqual('Download copy', browser.css('a').first.text)
def test_open_pdf_in_a_new_window_disabled(self, browser): dossier = create(Builder('dossier')) document = create(Builder('document') .within(dossier) .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) browser.login().visit(document, view="bumblebee-overlay-listing") self.assertNotIn('target=', browser.css('#action-pdf').first.outerHTML)
def test_returns_download_copy_link_as_html_link(self, browser): dossier = create(Builder('dossier')) document = create(Builder('document') .within(dossier) .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) adapter = getMultiAdapter((document, self.request), IBumblebeeOverlay) browser.open_html(adapter.get_download_copy_link()) self.assertEqual('Download copy', browser.css('a').first.text)
def test_actions_with_file(self, browser): dossier = create(Builder('dossier')) document = create( Builder('document').within(dossier).attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) browser.login().visit(document, view="bumblebee-overlay-listing") self.assertEqual([ 'Edit metadata', 'Checkout and edit', 'Download copy', 'Open as PDF', 'Open detail view' ], browser.css('.file-action-buttons a').text)
def test_pdf_conversion_is_disabled_by_default(self): create( Builder('document').within(self.dossier).attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) get_queue().reset() with RequestsSessionMock.installed(): api.content.transition(obj=self.dossier, transition='dossier-transition-resolve') transaction.commit() self.assertEquals(0, len(get_queue().queue))
def test_returns_checkout_and_edit_url(self): dossier = create(Builder('dossier')) document = create(Builder('document') .within(dossier) .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) adapter = getMultiAdapter((document, self.request), IBumblebeeOverlay) self.assertIn( 'http://nohost/plone/dossier-1/document-1/editing_document', adapter.get_checkout_url())
def test_open_pdf_in_a_new_window_enabled(self, browser): api.portal.set_registry_record('open_pdf_in_a_new_window', True, interface=IGeverBumblebeeSettings) dossier = create(Builder('dossier')) document = create( Builder('document').within(dossier).attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) browser.login().visit(document, view='bumblebee-overlay-listing') self.assertIn('target=', browser.css('.function-pdf-preview').first.outerHTML)
def test_actions_with_file_checked_out_by_another_user(self, browser): create( Builder('user').with_userid('hans').with_roles( 'Contributor', 'Editor', 'Reader')) dossier = create(Builder('dossier')) document = create( Builder('document').within(dossier).attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx').checked_out_by('hans')) browser.login().visit(document, view="bumblebee-overlay-listing") self.assertEqual(['Open as PDF', 'Open detail view'], browser.css('.file-action-buttons a').text)
def test_actions_with_versioned_document(self, browser): 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) transaction.commit() browser.login() browser.open(document, view="bumblebee-overlay-document?version_id=1") self.assertEqual(['Download copy', 'Revert document'], browser.css('.file-action-buttons a').text)
def test_pdf_conversion_is_disabled_by_default(self): create(Builder('document') .within(self.dossier) .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) get_queue().reset() with RequestsSessionMock.installed(): api.content.transition(obj=self.dossier, transition='dossier-transition-resolve') transaction.commit() self.assertEquals(0, len(get_queue().queue))
def test_actions_with_versioned_document(self, browser): 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) transaction.commit() browser.login().visit(document, view="bumblebee-overlay-document?version_id=1") self.assertEqual( ['Revert document', 'Download copy'], browser.css('.file-actions a').text)
def test_actions_with_file(self, browser): dossier = create(Builder('dossier')) document = create(Builder('document') .within(dossier) .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) browser.login().visit(document, view="bumblebee-overlay-document") self.assertEqual( ['Checkout and edit', 'Edit metadata', 'Download copy', 'Open as PDF'], browser.css('.file-actions a').text)
def test_prevents_checked_out_document_checksum_update(self): document = create( Builder('document').attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx').checked_out()) self.assertEquals(DOCX_CHECKSUM, IBumblebeeDocument(document).get_checksum()) document.update_file(filename=u'foo.txt', content_type='text/plain', data='foo') notify(ObjectModifiedEvent(document)) self.assertEquals(DOCX_CHECKSUM, IBumblebeeDocument(document).get_checksum())
def test_open_pdf_in_a_new_window_enabled(self, browser): api.portal.set_registry_record('open_pdf_in_a_new_window', True, interface=IGeverBumblebeeSettings) dossier = create(Builder('dossier')) document = create(Builder('document') .within(dossier) .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) browser.login().visit(document, view='bumblebee-overlay-listing') self.assertIn('target=', browser.css('#action-pdf').first.outerHTML)
def test_returns_none_if_user_is_not_allowed_to_edit(self): dossier = create(Builder('dossier')) document = create( Builder('document').within(dossier).attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) create( Builder('user').with_userid('bond').with_roles('Member', 'Reader')) adapter = getMultiAdapter((document, self.request), IBumblebeeOverlay) self.assertIn( 'http://nohost/plone/dossier-1/document-1/editing_document', adapter.get_checkout_url()) login(self.portal, 'bond') self.assertIsNone(None, adapter.get_checkout_url())
def test_queues_bumblebee_storing_after_revert_to_previous_version(self): self.login(self.dossier_responsible) self.subdocument.update_file( 'foo', content_type='text/plain', filename=u'foo.txt', ) create_document_version( self.subdocument, 1, data=bumblebee_asset('example.docx').bytes(), ) create_document_version(self.subdocument, 2) queue = get_queue() queue.reset() manager = self.get_checkout_manager(self.subdocument) manager.revert_to_version(1) self.assertEquals(1, len(queue), 'Expected 1 job in the queue.') expected_job = { 'application': 'local', 'file_url': ('http://nohost/plone/bumblebee_download?checksum={}&uuid={}'. format(DOCX_CHECKSUM, IUUID(self.subdocument))), 'salt': IUUID(self.subdocument), 'checksum': DOCX_CHECKSUM, 'deferred': False, 'url': ('/plone/ordnungssystem/fuhrung/vertrage-und-vereinbarungen' '/dossier-1/dossier-2/document-22/bumblebee_trigger_storing'), } found_job, = queue.queue self.assertDictEqual(expected_job, found_job)
def test_returns_none_if_user_is_not_allowed_to_edit(self): dossier = create(Builder('dossier')) document = create(Builder('document') .within(dossier) .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) create(Builder('user') .with_userid('bond') .with_roles('Member', 'Reader')) adapter = getMultiAdapter((document, self.request), IBumblebeeOverlay) self.assertIn( 'http://nohost/plone/dossier-1/document-1/editing_document', adapter.get_checkout_url()) login(self.portal, 'bond') self.assertIsNone(None, adapter.get_checkout_url())
def test_prevents_checked_out_document_checksum_update(self): document = create(Builder('document') .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx') .checked_out()) self.assertEquals( DOCX_CHECKSUM, IBumblebeeDocument(document).get_checksum()) document.update_file(filename=u'foo.txt', content_type='text/plain', data='foo') notify(ObjectModifiedEvent(document)) self.assertEquals( DOCX_CHECKSUM, IBumblebeeDocument(document).get_checksum())
def test_actions_with_file_checked_out_by_another_user(self, browser): hans = create(Builder('user') .with_userid('hans') .with_roles('Contributor', 'Editor', 'Reader')) dossier = create(Builder('dossier')) document = create(Builder('document') .within(dossier) .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx') .checked_out_by('hans')) browser.login().visit(document, view="bumblebee-overlay-document") self.assertEqual( ['Edit metadata', 'Download copy', 'Open as PDF'], browser.css('.file-actions a').text)
def test_download_last_version_for_checked_out_docs(self, browser): content = bumblebee_asset("example.docx").bytes() document = create(Builder("document").attach_file_containing(content, u"example.docx").checked_out()) document.update_file(filename=u"foo.txt", content_type="text/plain", data="foo") notify(ObjectModifiedEvent(document)) transaction.commit() # checksum has not been updated self.assertEqual(DOCX_CHECKSUM, IBumblebeeDocument(document).get_checksum()) # download first history version browser.open( view="bumblebee_download", data={"token": download_token_for(document), "uuid": IUUID(document), "checksum": DOCX_CHECKSUM}, ) self.assertEqual(content, browser.contents) self.assertEqual( "application/vnd.openxmlformats-officedocument.wordprocessingml.document", browser.headers.get("Content-Type"), )
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(filename=u'foo.txt', content_type='text/plain', data='foo') 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()) repository = api.portal.get_tool("portal_repository") history = repository.getHistoryMetadata(document) self.assertEqual(2, history.getLength(countPurged=False)) version_0 = repository.retrieve(document, 0) self.assertEqual(DOCX_CHECKSUM, IBumblebeeDocument(version_0.object).get_checksum()) # document checksum should be updated before storing the version version_1 = repository.retrieve(document, 1) self.assertEqual(TXT_CHECKSUM, IBumblebeeDocument(version_1.object).get_checksum())
def test_tooltip_actions(self, browser): dossier = create(Builder('dossier')) document = create(Builder('document') .within(dossier) .with_dummy_content() .attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx')) browser.login().open(document, view='tooltip') metadata, checkout, download, details = browser.css( '.file-action-buttons a') # metadata self.assertEquals('Edit metadata', metadata.text) self.assertEquals( 'http://nohost/plone/dossier-1/document-1' '/edit_checker', metadata.get('href')) # checkout and edit self.assertEquals('Checkout and edit', checkout.text) self.assertTrue(checkout.get('href').startswith( 'http://nohost/plone/dossier-1/document-1' '/editing_document?_authenticator=' )) # download copy self.assertEquals('Download copy', download.text) self.assertTrue(download.get('href').startswith( 'http://nohost/plone/dossier-1/document-1' '/file_download_confirmation?_authenticator=')) # link to details self.assertEquals('Open detail view', details.text) self.assertEquals('http://nohost/plone/dossier-1/document-1', details.get('href'))
def setUp(self): super(TestBumblebeeIntegrationWithDisabledFeature, self).setUp() self.document = create( Builder('document').attach_file_containing( bumblebee_asset('example.docx').bytes(), u'example.docx'))
def create_treaty_dossiers(self): self.dossier = self.register( 'dossier', create( Builder('dossier').within(self.repofolder00).titled( u'Vertr\xe4ge mit der kantonalen Finanzverwaltung'). having( description=u'Alle aktuellen Vertr\xe4ge mit der kantonalen ' u'Finanzverwaltung sind hier abzulegen. Vertr\xe4ge vor 2016 ' u'geh\xf6ren ins Archiv.', keywords=( u'Finanzverwaltung', u'Vertr\xe4ge', ), start=date(2016, 1, 1), responsible=self.dossier_responsible.getId(), external_reference=u'qpr-900-9001-\xf7', ))) create( Builder('contact_participation').for_contact( self.meier_ag).for_dossier(self.dossier).with_roles( ['final-drawing'])) create( Builder('contact_participation').for_contact( self.josef_buehler).for_dossier(self.dossier).with_roles( ['final-drawing', 'participation'])) self.document = self.register( 'document', create( Builder('document').within( self.dossier).titled(u'Vertr\xe4gsentwurf').having( document_date=datetime(2010, 1, 3), document_author=TEST_USER_ID, document_type='contract', receipt_date=datetime(2010, 1, 3), delivery_date=datetime(2010, 1, 3), ).attach_file_containing( bumblebee_asset('example.docx').bytes(), u'vertragsentwurf.docx'))) self.task = self.register( 'task', create( Builder('task').within(self.dossier).titled( u'Vertragsentwurf \xdcberpr\xfcfen').having( responsible_client=self.org_unit.id(), responsible=self.regular_user.getId(), issuer=self.dossier_responsible.getId(), task_type='correction', deadline=date(2016, 11, 1), ).in_state('task-state-in-progress').relate_to( self.document))) self.register( 'subtask', create( Builder('task').within(self.task).titled( u'Rechtliche Grundlagen in Vertragsentwurf \xdcberpr\xfcfen', ).having( responsible_client=self.org_unit.id(), responsible=self.regular_user.getId(), issuer=self.dossier_responsible.getId(), task_type='correction', deadline=date(2016, 11, 1), ).in_state('task-state-resolved').relate_to(self.document))) self.register( 'taskdocument', create( Builder('document').within(self.task).titled( u'Feedback zum Vertragsentwurf').attach_file_containing( 'Feedback text', u'vertr\xe4g sentwurf.docx', ))) proposal = self.register( 'proposal', create( Builder('proposal').within(self.dossier).having( title= u'Vertragsentwurf f\xfcr weitere Bearbeitung bewilligen', committee=self.committee.load_model(), ).relate_to(self.document).as_submitted())) self.register_path( 'submitted_proposal', proposal.load_model().submitted_physical_path.encode('utf-8'), ) self.register( 'draft_proposal', create( Builder('proposal').within(self.dossier).having( title=u'Antrag f\xfcr Kreiselbau', committee=self.empty_committee.load_model(), ))) self.decided_proposal = create( Builder('proposal').within(self.dossier).having( title=u'Initialvertrag f\xfcr Bearbeitung', committee=self.committee.load_model(), ).as_submitted()) self.register_path( 'decided_proposal', self.decided_proposal.load_model().submitted_physical_path.encode( 'utf-8'), ) with self.features('meeting', 'word-meeting'): word_proposal = self.register( 'word_proposal', create( Builder('proposal').within(self.dossier).having( title=u'\xc4nderungen am Personalreglement', committee=self.committee.load_model(), ).relate_to(self.document).with_proposal_file( assets.load('vertragsentwurf.docx')).as_submitted())) self.register_path( 'submitted_word_proposal', word_proposal.load_model().submitted_physical_path.encode( 'utf-8'), ) self.register( 'draft_word_proposal', create( Builder('proposal').within(self.dossier).having( title=u'\xdcberarbeitung der GAV', committee=self.empty_committee.load_model(), ))) subdossier = self.register( 'subdossier', create( Builder('dossier').within(self.dossier).titled(u'2016').having( keywords=(u'Subkeyword', u'Subkeyw\xf6rd'), ))) self.register( 'subdossier2', create(Builder('dossier').within(self.dossier).titled(u'2015'))) self.register( 'subdocument', create( Builder('document').within(subdossier).titled( u'\xdcbersicht der Vertr\xe4ge von 2016'). attach_file_containing( 'Excel dummy content', u'tab\xe4lle.xlsx', ))) archive_dossier = self.register( 'archive_dossier', create( Builder('dossier').within( self.repofolder00).titled(u'Archiv Vertr\xe4ge').having( description=u'Archiv der Vertr\xe4ge vor 2016.', keywords=(u'Vertr\xe4ge'), start=date(2000, 1, 1), end=date(2015, 12, 31), responsible=self.dossier_responsible.getId(), ).in_state('dossier-state-resolved'))) archive_document = self.register( 'archive_document', create( Builder('document').within(archive_dossier).titled( u'\xdcbersicht der Vertr\xe4ge vor 2016'). attach_archival_file_containing( 'TEST', name=u'test.pdf').with_dummy_content())) self.register( 'archive_task', create( Builder('task').within(archive_dossier). titled(u'Vertr\xe4ge abschliessen').having( responsible_client=self.org_unit.id(), responsible=self.regular_user.getId(), issuer=self.dossier_responsible.getId(), task_type='correction', deadline=date(2015, 12, 31), ).in_state('task-state-resolved').relate_to(archive_document))) inactive_dossier = self.register( 'inactive_dossier', create( Builder('dossier').within( self.repofolder00).titled(u'Inaktive Vertr\xe4ge').having( description=u'Inaktive Vertr\xe4ge von 2016.', keywords=(u'Vertr\xe4ge'), start=date(2016, 1, 1), end=date(2016, 12, 31), responsible=self.dossier_responsible.getId(), ).in_state('dossier-state-inactive'))) inactive_document = self.register( 'inactive_document', create( Builder('document').within(inactive_dossier).titled( u'\xdcbersicht der Inaktiven Vertr\xe4ge von 2016'). attach_file_containing('Excel dummy content', u'tab\xe4lle.xlsx'))) self.register( 'inactive_task', create( Builder('task').within(inactive_dossier).titled( u'Status \xdcberpr\xfcfen').having( responsible_client=self.org_unit.id(), responsible=self.regular_user.getId(), issuer=self.dossier_responsible.getId(), task_type='correction', deadline=date(2016, 11, 1), ).in_state('task-state-in-progress').relate_to( inactive_document)))