source: products/quintagroup.quills.extras/trunk/quintagroup/quills/extras/tests/extras_quills_app_browser.rst @ 1577

Last change on this file since 1577 was 1225, checked in by mylan, 15 years ago

Merged revisions 2250-2256,2258 via svnmerge from
http://svn.quintagroup.com/products/quintagroup.quills.extras/branches/no_webresults

........

r2250 | mylan | 2009-08-05 17:50:46 +0300 (Wed, 05 Aug 2009) | 2 lines


moved webresults site cusomizations into elaw.quills.webresults package (#37)

........

r2251 | mylan | 2009-08-05 21:25:35 +0300 (Wed, 05 Aug 2009) | 1 line


Bind off from 4webresults theme skin: rebind resources to IQuillsExtrasLayer (browser layer), change QuillsLinks? portlet registration

........

r2252 | mylan | 2009-08-05 22:28:15 +0300 (Wed, 05 Aug 2009) | 1 line


Fix bug with quills_header_macros

........

r2253 | mylan | 2009-08-06 17:45:39 +0300 (Thu, 06 Aug 2009) | 1 line


Added tests for quills

........

r2254 | mylan | 2009-08-06 17:48:25 +0300 (Thu, 06 Aug 2009) | 1 line


Added support of both qPloneComments or quintagroup.plonecomments products

........

r2255 | mylan | 2009-08-06 19:26:31 +0300 (Thu, 06 Aug 2009) | 1 line


Move entry & weblog macroses from skins to /browser (acording to quills.app v.1.7.3)

........

r2256 | mylan | 2009-08-06 20:18:07 +0300 (Thu, 06 Aug 2009) | 1 line


Debug macroses refactoring, #37

........

r2258 | mylan | 2009-08-07 15:15:54 +0300 (Fri, 07 Aug 2009) | 1 line


Update tests because of integration quills with quintagroup.plonecomments (#37)

........

File size: 9.0 KB

Quills browser tests

Here we klick ourselves through a Quills instance and check that everything is in order. First some boilerplate to get our browser up and running:

>>> self.setRoles(("Contributor",))
>>> browser = self.getBrowser(logged_in=True)
>>> browser.handleErrors = False
>>> entry = self.weblog.addEntry("Blog entry",
...                              "Just for testing",
...                              "Nothing to see.",
...                              ['fishslapping'],
...                              id="entry")
>>> from quills.core.interfaces import IWeblogEntry
>>> IWeblogEntry.providedBy(entry)
True
>>> entry.publish()
>>> browser.open('http://nohost/plone/weblog/')

portlets

Viewing the blog we should get a few portlets. authors, recent entries and the tag cloud:

>>> browser.contents
'...<dl class="portlet portletWeblogAuthors"...'
>>> browser.contents
'...<dl class="portlet portletRecentEntries"...'
>>> browser.contents
'...<dl class="portlet portletWeblogArchive"...'
>>> browser.contents
'...<dl class="portlet portletTagCloud"...
 ...<a...href="http://nohost/plone/weblog/topics/fishslapping"...
 ...title="1 entries">fishslapping</a>...'

And since we're authenticated as Contributor, we also get the admin portlet:

>>> browser.contents
'...<dl class="portlet portletWeblogAdmin"...'

And last but not least, the Quills portlet:

>>> browser.contents
'...<dl class="portlet portletQuillsLinks"...'

archive

having one published entry also gives us an archive:

>>> date = self.weblog.getEntry('entry').getPublicationDate()
>>> year = str(date.year())
>>> month = str(date.month()).zfill(2)
>>> day = str(date.day()).zfill(2)
>>> browser.open('http://nohost/plone/weblog/%s/' % year)
>>> ('<h1>%s' % year) in browser.contents
True

Viewing the archive should still give us a context where the portlets are rendered. We test this by checking for the quillslinks portlet:

>> browser.contents '...<dl class="portlet portletQuillsLinks"...'

>>> from Products.CMFPlone.i18nl10n import monthname_english
>>> browser.open('http://nohost/plone/weblog/%s/%s/' % (year, month))
>>> ('<h1>%s' % monthname_english(month)) in browser.contents
True

>> browser.contents '...<dl class="portlet portletQuillsLinks"...'

>>> browser.open('http://nohost/plone/weblog/%s/%s/%s/' % (year, month, day))
>>> browser.contents
'...Blog entry...'
>>> browser.contents
'...<dl class="portlet portletQuillsLinks"...'

topics

>>> browser.open('http://nohost/plone/weblog/topics')
>>> '<div id="weblogtopics">' in browser.contents
True

Viewing the topics overview should still give us a context where the portlets are rendered. We test this by checking for the quillslinks portlet:

>> browser.contents '...<dl class="portlet portletQuillsLinks"...'

Having a published entry with the topic 'fishslapping' gives us the following:

>>> browser.open('http://nohost/plone/weblog/topics/fishslapping')
>>> '<div id="topic-summary">' in browser.contents
True
>>> 'Blog entry' in browser.contents
True
>>> '<h1>fishslapping</h1>' in browser.contents
True

Viewing the topic view should still give us a context where the portlets are rendered. We test this by checking for the quillslinks portlet:

>>> browser.contents
'...<dl class="portlet portletQuillsLinks"...'

author topics

>>> browser.open('http://nohost/plone/weblog/authors')
>>> '<h1 class="documentFirstHeading">Weblog Authors</h1>' in browser.contents
True
>>> '<a href="http://nohost/plone/weblog/authors/portal_owner">portal_owner</a>' in browser.contents
True

configure blog

We need the Manager role to configure the weblog:

>>> self.setRoles(("Manager",))

Now let's configure it ttw:

>>> browser.open('http://nohost/plone/weblog')
>>> browser.getLink('Configure').click()
>>> browser.url
'http://nohost/plone/weblog/config_view'

But we can also reach this screen via the management portlet:

>>> browser.getLink('Configure Blog').click()
>>> browser.url
'http://nohost/plone/weblog/config_view'

Manage Comments View

We'll test the 'manage_comments' view here - the view that is used to help keep all comments within a blog in some sense of order.

Can we access the view?

>>> browser.open('http://nohost/plone/weblog/@@manage_comments')

What about if there are some comments present within the blog? By default we need the `Manager' role to add comments:

?
>>> self.setRoles(("Contributor", "Reviewer", "Manager"))

We also need to enable comments for the portal type underlying our weblog entry.

>>> entry = self.weblog.getEntry('entry')
>>> # Remember, the return value from getEntry could be catalogbrain-ish, or
>>> # an adapter, or an actual content-ish entry object.
>>> entry_content = entry.getWeblogEntryContentObject()
>>> portal_type = entry_content.portal_type

Now we need to enable commenting for our portal_type.

>>> dtype = self.portal.portal_types[portal_type]
>>> dtype.manage_changeProperties(allow_discussion=1)
>>> entry_content.allowDiscussion(1)
>>> entry_content.reindexObject()

Let's add a comment to our weblog entry.

>>> dtool = self.portal.portal_discussion
>>> discussion = dtool.getDiscussionFor(entry_content)
>>> id = discussion.createReply(title='Parrots', text='... talk like people.')

Now, can we still access the comments view?

>>> browser.open('http://nohost/plone/weblog/@@manage_comments')
Note: See TracBrowser for help on using the repository browser.