Collection (Topic) views ------------------------ Ensure Title, description and text are actually shown at the various views for a Collection - #10226: folder_listing (Standard view) folder_summary_view (Summary view) folder_full_view (All content) folder_tabular_view (Tabular view) First create a folder and a demo collection: >>> self.setRoles(['Manager']) >>> _ = self.portal.invokeFactory('Folder', 'folder') >>> folder = self.portal.folder >>> folder.setTitle('Folder title') >>> folder.setDescription('Folder description') >>> _ = folder.invokeFactory('Collection', 'collection') >>> collection = folder.collection >>> collection_title = 'Title. Lorem ipsum dolor sit amet' >>> collection.setTitle(collection_title) >>> collection_description = 'Description. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod.' >>> collection.setDescription(collection_description) >>> collection_text = '
Text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
' >>> collection.setText(collection_text, mimetype='text/html') >>> import transaction; transaction.commit() Now let's login and visit the collection in the test browser: >>> from plone.testing.z2 import Browser >>> from plone.app.testing import TEST_USER_NAME >>> from plone.app.testing import TEST_USER_PASSWORD >>> browser = Browser(app) >>> browser.open('http://nohost/plone/login_form') >>> browser.getControl('Login Name').value = TEST_USER_NAME >>> browser.getControl('Password').value = TEST_USER_PASSWORD >>> browser.getControl('Log in').click() >>> browser.open('http://nohost/plone/folder/collection') Lets check the folder_listing (Standard view): >>> browser.getLink('Standard view').click() >>> collection_title in browser.contents True >>> collection_description in browser.contents True >>> collection_text in browser.contents True Lets check the folder_summary_view (Summary view): >>> browser.getLink('Standard view').click() >>> collection_title in browser.contents True >>> collection_description in browser.contents True >>> collection_text in browser.contents True Lets check the folder_full_view (All content): >>> browser.getLink('All content').click() >>> collection_title in browser.contents True >>> collection_description in browser.contents True >>> collection_text in browser.contents True Lets check the folder_tabular_view (Tabular view): >>> browser.handleErrors = False >>> browser.getLink('Tabular view').click() >>> collection_title in browser.contents True >>> collection_description in browser.contents True >>> collection_text in browser.contents True Lets ensure that the text field is not requested on a folder. We are pragmatic here and only test on the default view of a folder - folder_contents: >>> browser.open('http://nohost/plone/folder') >>> browser.getLink('Standard view').click() >>> 'Folder title' in browser.contents True >>> 'Folder description' in browser.contents True Lets ensure text is shown when Collection is default view of a folder >>> browser.open('http://nohost/plone/folder') >>> browser.getLink('Select a content item as default view...').click() >>> browser.getControl(name='objectId').value = ['collection'] >>> browser.getControl('Save').click() >>> collection_title in browser.contents True >>> collection_description in browser.contents True >>> collection_text in browser.contents True