Example #1
0
    def test_document_brain_checked_out_suffix(self):
        self.login(self.dossier_responsible)

        self.assertEquals('icon-docx', get_css_class(obj2brain(self.document)))

        self.checkout_document(self.document)
        self.assertEquals('icon-docx is-checked-out-by-current-user',
                          get_css_class(obj2brain(self.document)))
Example #2
0
    def test_document_brain_checked_out_suffix(self):
        self.login(self.dossier_responsible)

        self.assertEquals('icon-docx', get_css_class(obj2brain(self.document)))

        self.checkout_document(self.document)
        self.assertEquals('icon-docx is-checked-out-by-current-user',
                          get_css_class(obj2brain(self.document)))
Example #3
0
    def test_proposaltemplate_checked_out_by_other_suffix(self):
        self.login(self.dossier_responsible)
        self.checkout_document(self.proposal_template)

        self.login(self.regular_user)
        self.assertEquals('icon-docx is-checked-out',
                          get_css_class(obj2brain(self.proposal_template)))
Example #4
0
    def test_proposaltemplate_checked_out_by_other_suffix(self):
        self.login(self.dossier_responsible)
        self.checkout_document(self.proposal_template)

        self.login(self.regular_user)
        self.assertEquals('icon-docx is-checked-out',
                          get_css_class(obj2brain(self.proposal_template)))
Example #5
0
    def test_creator_index_gets_updated(self):
        migrator = CreatorMigrator(
            self.portal, {'old.user': '******'}, 'move')
        migrator.migrate()

        # Index should be up to date
        self.assertEquals('new.user',
                          index_data_for(self.dossier).get('Creator'))
        self.assertEquals('new.user',
                          index_data_for(self.doc).get('Creator'))

        # Metadata should be up to date
        self.assertEquals(('new.user', ), obj2brain(self.dossier).listCreators)
        self.assertEquals(('new.user', ), obj2brain(self.doc).listCreators)

        self.assertEquals('new.user', obj2brain(self.dossier).Creator)
        self.assertEquals('new.user', obj2brain(self.doc).Creator)
    def test_adding_document_with_a_userid_as_author_resolves_to_fullname(
            self):
        create_ogds_user('hugo.boss', firstname='Hugo', lastname='Boss')
        document = create(
            Builder('document').having(
                document_author='hugo.boss').with_dummy_content())

        self.assertEquals('Boss Hugo', document.document_author)
        self.assertEquals('Boss Hugo', obj2brain(document).document_author)
Example #7
0
    def test_refuse_set_task_copy_in_closed_state(self):
        wftool = getToolByName(self.portal, 'portal_workflow')
        status, copy = self.refuse_forwarding(self.forwarding)

        self.assertEquals('forwarding-state-closed',
                          wftool.getInfoFor(copy, 'review_state'))
        self.assertEquals('forwarding-state-closed',
                          obj2brain(copy).review_state)
        self.assertEquals('forwarding-state-closed',
                          task2sqltask(copy).review_state)
    def test_refuse_set_task_copy_in_closed_state(self):
        wftool = getToolByName(self.portal, 'portal_workflow')
        status, copy = self.refuse_forwarding(self.forwarding)

        self.assertEquals('forwarding-state-closed',
                          wftool.getInfoFor(copy, 'review_state'))
        self.assertEquals('forwarding-state-closed',
                          obj2brain(copy).review_state)
        self.assertEquals('forwarding-state-closed',
                          copy.get_sql_object().review_state)
    def test_editing_document_with_a_userid_as_author_resolves_to_fullname(self):
        create_ogds_user("hugo.boss", firstname="Hugo", lastname="Boss")
        document = create(Builder("document").having(document_author="hanspeter").with_dummy_content())

        self.browser.open("%s/edit" % (document.absolute_url()))
        self.browser.fill({"Author": u"hugo.boss"})
        self.browser.click("Save")

        self.assertEquals("Boss Hugo", document.document_author)
        self.assertEquals("Boss Hugo", obj2brain(document).document_author)
    def test_dossier_responsible_index_gets_updated(self):
        migrator = DossierMigrator(
            self.portal, {'old.user': '******'}, 'move')
        migrator.migrate()

        # Index should be up to date
        brains = self.catalog(responsible='new.user')
        self.assertEquals(1, len(brains))

        # Metadata should be up to date
        self.assertEquals('new.user', obj2brain(self.dossier).responsible)
Example #11
0
    def test_import_toplevel_documents_in_dossier(self, browser):
        self.activate_feature('ech0147-import')
        self.login(self.regular_user, browser)
        browser.open(self.dossier, view='ech0147_import')
        with open(get_path('message_docs_only.zip')) as file_:
            browser.forms['form'].fill({
                'File': file_,
            }).submit()
        docs = self.dossier.objectValues()[-2:]
        self.assertEqual(docs[0].Title(), 'Kaufvertrag')
        self.assertEqual(docs[1].Title(), 'Grundrissplan')

        self.assertIsNotNone(obj2brain(docs[0]).bumblebee_checksum)
Example #12
0
    def test_editing_document_with_a_userid_as_author_resolves_to_fullname(
            self):
        create_ogds_user('hugo.boss', firstname='Hugo', lastname='Boss')
        document = create(
            Builder('document').having(
                document_author='hanspeter').with_dummy_content())

        self.browser.open('%s/edit' % (document.absolute_url()))
        self.browser.fill({'Author': u'hugo.boss'})
        self.browser.click('Save')

        self.assertEquals('Boss Hugo', document.document_author)
        self.assertEquals('Boss Hugo', obj2brain(document).document_author)
Example #13
0
    def test_import_toplevel_documents_in_dossier(self, browser):
        self.activate_feature('ech0147-import')
        self.login(self.regular_user, browser)
        browser.open(self.dossier, view='ech0147_import')
        with open(get_path('message_docs_only.zip')) as file_:
            browser.forms['form'].fill({
                'File': file_,
            }).submit()
        docs = self.dossier.objectValues()[-2:]
        self.assertEqual(docs[0].Title(), 'Kaufvertrag')
        self.assertEqual(docs[1].Title(), 'Grundrissplan')

        self.assertIsNotNone(obj2brain(docs[0]).bumblebee_checksum)
Example #14
0
 def test_proposaltemplate_brain_with_icon(self):
     self.login(self.dossier_responsible)
     brain = obj2brain(self.proposal_template)
     self.assertEquals(brain.getIcon, 'docx.png')
     self.assertEquals(get_css_class(brain), 'icon-docx')
Example #15
0
    def test_adding_document_with_a_userid_as_author_resolves_to_fullname(self):
        create_ogds_user("hugo.boss", firstname="Hugo", lastname="Boss")
        document = create(Builder("document").having(document_author="hugo.boss").with_dummy_content())

        self.assertEquals("Boss Hugo", document.document_author)
        self.assertEquals("Boss Hugo", obj2brain(document).document_author)
Example #16
0
 def test_document_brain_with_icon(self):
     self.login(self.dossier_responsible)
     brain = obj2brain(self.document)
     self.assertEquals(brain.getIcon, 'docx.png')
     self.assertEquals(get_css_class(brain), 'icon-docx')
Example #17
0
 def test_document_brain_with_icon(self):
     self.login(self.dossier_responsible)
     brain = obj2brain(self.document)
     self.assertEquals(brain.getIcon, 'docx.png')
     self.assertEquals(get_css_class(brain), 'icon-docx')
Example #18
0
 def test_proposaltemplate_brain_with_icon(self):
     self.login(self.dossier_responsible)
     brain = obj2brain(self.proposal_template)
     self.assertEquals(brain.getIcon, 'docx.png')
     self.assertEquals(get_css_class(brain), 'icon-docx')