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())
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())
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())
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())
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())
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)
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_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_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)
def test_customstyles_link_works(self, browser): browser.login().open() browser.find('Manage styles').click() self.assertEquals('customstyles_form', plone.view())
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())
def test_thankyou_page_when_finishing_checkout(self, browser): checkout.goto(checkout.ORDER_REVIEW).finish() self.assertEquals('thankyou', plone.view())
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())
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')
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())
def test_adding_content(self, browser): browser.login(SITE_OWNER_NAME).open() factoriesmenu.add('Folder') self.assertEquals('atct_edit', plone.view())
def test_view_on_root(self, browser): browser.open() self.assertEquals('folder_listing', plone.view())
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())
def test_clicking_links(self, browser): browser.open().find("Site Map").click() self.assertEquals("sitemap", plone.view())
def test_click_on_shortcut(self, browser): browser.open().click_on("Site Map") self.assertEquals("sitemap", plone.view())
def test_view_on_login_form(self, browser): browser.open(view='login_form') self.assertEquals('login_form', plone.view())
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())
def test_view_on_root(self, browser): browser.open() self.assertEquals('listing_view', plone.view(browser=browser))