コード例 #1
0
    def test_object_addable_without_delete_permission(self, browser):
        user = create(Builder('user').with_roles('Contributor'))
        self.revoke_permission('Delete portal content', on=self.layer['portal'])
        transaction.commit()

        browser.login(user).open()
        factoriesmenu.add(self.folder_name)
        browser.fill({'Title': 'Foo'}).save()
        statusmessages.assert_no_error_messages()
        if IS_PLONE_5_OR_GREATER:
            self.assertEquals('listing_view', plone.view())
        else:
            self.assertEquals('folder_listing', plone.view())
コード例 #2
0
    def test_object_addable_without_delete_permission(self, browser):
        user = create(Builder('user').with_roles('Contributor'))
        self.revoke_permission('Delete portal content',
                               on=self.layer['portal'])
        transaction.commit()

        browser.login(user).open()
        factoriesmenu.add(self.folder_name)
        browser.fill({'Title': 'Foo'}).save()
        statusmessages.assert_no_error_messages()
        if IS_PLONE_5_OR_GREATER:
            self.assertEquals('listing_view', plone.view())
        else:
            self.assertEquals('folder_listing', plone.view())
コード例 #3
0
 def test_fill_field_with_utf8_umlauts(self, browser):
     browser.login(SITE_OWNER_NAME).open()
     factoriesmenu.add('Folder')
     browser.fill({'Title': u'F\xf6lder'.encode('utf-8'),
                   'Summary': u'The f\xf6lder description'.encode('utf-8')}).save()
     self.assertEquals('listing_view', plone.view())
     self.assertEquals(u'F\xf6lder', plone.first_heading())
コード例 #4
0
    def test_lists_only_restorable_content(self, browser):
        self.grant('Site Administrator')

        create(Builder('folder').titled(u'Keep that'))
        parent = create(Builder('folder').titled(u'Parent'))
        folder = create(
            Builder('folder').titled(u'Delete that').within(parent))
        create(
            Builder('folder').titled(u'Child of folder to be deleted').within(
                folder))

        with freeze(datetime(2016, 12, 15, 17, 9)):
            Trasher(folder).trash()

        transaction.commit()
        browser.login().open().click_on('Trash')
        self.assertEquals('trash', plone.view())

        self.assertEquals([{
            'Last modified': 'Dec 15, 2016 05:09 PM',
            'Type': self.type_label,
            'Title': 'Delete that http://nohost/plone/parent/delete-that',
            '': ''
        }],
                          browser.css('.trash-table').first.dicts())
コード例 #5
0
    def test_control_panel_link_points_to_spec_listing(self, browser):
        browser.login(SITE_OWNER_NAME).open(view='overview-controlpanel')
        links = browser.css('ul.configlets li').find('Lawgiver')
        self.assertTrue(links, 'The "Lawgiver" control panel link is missing.')

        links.first.click()
        self.assertEquals('lawgiver-list-specs', plone.view())
コード例 #6
0
 def test_fill_archtypes_field_with_unicode_umlauts(self, browser):
     browser.login(SITE_OWNER_NAME).open()
     factoriesmenu.add('Folder')
     browser.fill({'Title': u'F\xf6lder',
                   'Description': u'The f\xf6lder description'}).submit()
     self.assertEquals('folder_listing', plone.view())
     self.assertEquals(u'F\xf6lder', plone.first_heading())
コード例 #7
0
    def test_adding(self, browser):
        browser.login().open(self.portal)
        factoriesmenu.add('Template Dossier')
        browser.fill({'Title': 'Templates',
                      'Responsible': TEST_USER_ID}).save()

        self.assertEquals('tabbed_view', plone.view())
 def test_usera_renames_docs_folder_contents(self, browser):
     """Check if we are able to rename docs over folder_contents."""
     browser.login(self.user_a).open(self.folder_a, view='folder_contents')
     folder_contents.select(self.doc_a, self.doc_b)
     folder_contents.form().find('Rename').click()
     self.assertEqual('folder_rename_form', plone.view())
     self.assertEqual('doc-a', browser.css('#doc-a_id').first.value)
     self.assertEqual('doc-b', browser.css('#doc-b_id').first.value)
コード例 #9
0
    def test_cancel_redirects_to_the_dossier(self, browser):
        self.login(self.regular_user, browser)
        browser.open(self.dossier, view='document_with_template')

        browser.find('Cancel').click()

        self.assertEquals(self.dossier, browser.context)
        self.assertEquals('tabbed_view', plone.view())
 def test_usera_renames_docs_folder_contents(self, browser):
     """Check if we are able to rename docs over folder_contents."""
     browser.login(self.user_a).open(self.folder_a, view='folder_contents')
     folder_contents.select(self.doc_a, self.doc_b)
     folder_contents.form().find('Rename').click()
     self.assertEqual('folder_rename_form', plone.view())
     self.assertEqual('doc-a', browser.css('#doc-a_id').first.value)
     self.assertEqual('doc-b', browser.css('#doc-b_id').first.value)
コード例 #11
0
    def test_cancel_redirects_to_the_dossier(self, browser):
        self.login(self.regular_user, browser)
        browser.open(self.dossier, view='document_with_template')

        browser.find('Cancel').click()

        self.assertEquals(self.dossier, browser.context)
        self.assertEquals('tabbed_view', plone.view())
コード例 #12
0
    def test_adding(self, browser):
        browser.login().open(self.portal)
        factoriesmenu.add('Template Dossier')
        browser.fill({
            'Title': 'Templates',
            'Responsible': TEST_USER_ID
        }).save()

        self.assertEquals('tabbed_view', plone.view())
コード例 #13
0
    def test_edit_meeting_locks_the_content(self, browser1):
        self.login(self.committee_responsible)
        with browser1.clone() as browser2:
            browser1.login(self.committee_responsible)
            browser2.login(self.administrator)

            browser1.open(self.meeting, view='edit-meeting')
            self.assertEquals('edit-meeting', plone.view(browser1))

            browser2.open(self.meeting, view='edit-meeting')
            self.assertEquals('view', plone.view(browser2))
            statusmessages.assert_message(
                u'This item was locked by M\xfcller Fr\xe4nzi 1 minute ago.'
                u' If you are certain this user has abandoned the object,'
                u' you may the object. You will then be able to edit it.',
                browser=browser2)

            browser1.click_on('Cancel')
            browser2.open(self.meeting, view='edit-meeting')
            self.assertEquals('edit-meeting', plone.view(browser2))
コード例 #14
0
    def test_edit_meeting_locks_the_content(self, browser1):
        self.login(self.committee_responsible)
        with browser1.clone() as browser2:
            browser1.login(self.committee_responsible)
            browser2.login(self.administrator)

            browser1.open(self.meeting, view='edit-meeting')
            self.assertEquals('edit-meeting', plone.view(browser1))

            browser2.open(self.meeting, view='edit-meeting')
            self.assertEquals('view', plone.view(browser2))
            statusmessages.assert_message(
                u'This item was locked by M\xfcller Fr\xe4nzi 1 minute ago.'
                u' If you are certain this user has abandoned the object,'
                u' you may the object. You will then be able to edit it.',
                browser=browser2)

            browser1.click_on('Cancel')
            browser2.open(self.meeting, view='edit-meeting')
            self.assertEquals('edit-meeting', plone.view(browser2))
 def test_userb_renames_docs_folder_contents(self, browser):
     """Check if the permission also works when we rename over
     folder_contents.
     """
     browser.login(self.user_b).open(self.folder_a, view='folder_contents')
     folder_contents.select(self.doc_a, self.doc_b)
     folder_contents.form().find('Rename').click()
     self.assertEqual('folder_rename_form', plone.view())
     self.assertEqual(
         ['You are not allowed to modify the id of this item.',
          'You are not allowed to modify the title of this item.'],
         browser.css('#content fieldset .error span').text)
     self.assertFalse(browser.css('#doc-a_id'))
     self.assertEqual('doc-b', browser.css('#doc-b_id').first.value)
 def test_userb_renames_docs_folder_contents(self, browser):
     """Check if the permission also works when we rename over
     folder_contents.
     """
     browser.login(self.user_b).open(self.folder_a, view='folder_contents')
     folder_contents.select(self.doc_a, self.doc_b)
     folder_contents.form().find('Rename').click()
     self.assertEqual('folder_rename_form', plone.view())
     self.assertEqual([
         'You are not allowed to modify the id of this item.',
         'You are not allowed to modify the title of this item.'
     ],
                      browser.css('#content fieldset .error span').text)
     self.assertFalse(browser.css('#doc-a_id'))
     self.assertEqual('doc-b', browser.css('#doc-b_id').first.value)
コード例 #17
0
 def test_customstyles_link_works(self, browser):
     browser.login().open()
     browser.find('Manage styles').click()
     self.assertEquals('customstyles_form', plone.view())
コード例 #18
0
 def test_customstyles_link_works(self, browser):
     browser.login().open()
     browser.find('Manage styles').click()
     self.assertEquals('customstyles_form', plone.view())
コード例 #19
0
 def test_edit_cart_link_opens_edit_cart_view(self, browser):
     item = create(Builder('shop item'))
     browser.login().visit(item)
     shopitem.add_to_cart()
     cartportlet.edit_cart_link().click()
     self.assertEquals('cart_edit', plone.view())
コード例 #20
0
 def test_thankyou_page_when_finishing_checkout(self, browser):
     checkout.goto(checkout.ORDER_REVIEW).finish()
     self.assertEquals('thankyou', plone.view())
コード例 #21
0
 def test_order_link_opens_checkout_wizard(self, browser):
     item = create(Builder('shop item'))
     browser.login().visit(item)
     shopitem.add_to_cart()
     cartportlet.order_link().click()
     self.assertEquals('checkout-wizard', plone.view())
コード例 #22
0
 def test_editable_border_is_hidden(self, browser):
     self.grant('Manager')
     browser.login().visit(view='activity')
     self.assertEquals('activity', plone.view())
     self.assertFalse(browser.css('.documentEditable'),
                      'Editable border is visible')
コード例 #23
0
 def test_order_link_opens_checkout_wizard(self, browser):
     item = create(Builder('shop item'))
     browser.login().visit(item)
     shopitem.add_to_cart()
     cartportlet.order_link().click()
     self.assertEquals('checkout-wizard', plone.view())
コード例 #24
0
 def test_order_manager_link_points_to_order_manager_view(self, browser):
     browser.login().open()
     cartportlet.order_manager_link().click()
     self.assertEquals('order_manager', plone.view())
コード例 #25
0
 def test_adding_content(self, browser):
     browser.login(SITE_OWNER_NAME).open()
     factoriesmenu.add('Folder')
     self.assertEquals('atct_edit', plone.view())
コード例 #26
0
 def test_order_manager_link_points_to_order_manager_view(self, browser):
     browser.login().open()
     cartportlet.order_manager_link().click()
     self.assertEquals('order_manager', plone.view())
コード例 #27
0
 def test_view_on_root(self, browser):
     browser.open()
     self.assertEquals('folder_listing', plone.view())
コード例 #28
0
 def test_fill_field(self, browser):
     browser.login(SITE_OWNER_NAME).open()
     factoriesmenu.add('Folder')
     browser.fill({'Title': 'The Folder'}).save()
     self.assertEquals('listing_view', plone.view())
     self.assertEquals('The Folder', plone.first_heading())
コード例 #29
0
 def test_thankyou_page_when_finishing_checkout(self, browser):
     checkout.goto(checkout.ORDER_REVIEW).finish()
     self.assertEquals('thankyou', plone.view())
コード例 #30
0
 def test_clicking_links(self, browser):
     browser.open().find("Site Map").click()
     self.assertEquals("sitemap", plone.view())
コード例 #31
0
 def test_click_on_shortcut(self, browser):
     browser.open().click_on("Site Map")
     self.assertEquals("sitemap", plone.view())
コード例 #32
0
 def test_view_on_login_form(self, browser):
     browser.open(view='login_form')
     self.assertEquals('login_form', plone.view())
コード例 #33
0
 def test_edit_cart_link_opens_edit_cart_view(self, browser):
     item = create(Builder('shop item'))
     browser.login().visit(item)
     shopitem.add_to_cart()
     cartportlet.edit_cart_link().click()
     self.assertEquals('cart_edit', plone.view())
コード例 #34
0
 def test_owner_can_invite_new_users(self, browser):
     browser.login(self.john.getId()).visit(self.folder,
                                            view='participants')
     browser.find('Invite participants').click()
     self.assertEquals('invite_participants', plone.view())
コード例 #35
0
 def test_view_on_root(self, browser):
     browser.open()
     self.assertEquals('listing_view', plone.view(browser=browser))