[Product Developers] Difference between search form and catalog in testbrowser test

Maurits van Rees m.van.rees at zestsoftware.nl
Mon Apr 2 15:58:14 UTC 2007


Hi,

I am writing some testbrowser tests for eXtremeManagement (a project
management tool in Plone).  I add one Project (which is an Archetypes
content type) *without* testbrowser and one Project *with*
testbrowser.

Then I test if they can be found with the search form::

    >>> browser.open(self.portal.absolute_url() + '/search_form')
    >>> browser.getControl(name='portal_type:list').value = ['Project']
    >>> browser.getControl(name='submit').click()
    >>> browser.contents.count('contenttype-project')
    2
    >>> '2 items matching your criteria' in browser.contents
    True

So this finds two Projects, which is what I expect.

But when I ask the catalog:

    >>> len(self.catalog(portal_type='Project'))

it finds only one, which is the Project that was added without the
testbrowser.  That Project is added with a helper function

def addSimpleType(browser, container, title, type_name):
    """Add a content type with just a title.
    """
    browser.open(container.absolute_url() + '/createObject?type_name=' + type_name)
    browser.getControl(name='title').value = title
    browser.getControl(name='form_submit').click()
    if title not in browser.contents:
        return 'title not in browser.contents'
    if not browser.url.endswith('Changes%20saved.'):
        return 'Changes on edit form not saved.'

This returns no errors when adding my Project.

Given the right input this works fine for another content type,
ProjectFolder.  There both the search form and the catalog find the
testbrowser added ProjectFolder.

I tried it with ATDocument too (with the necessary changes as this has
an extra required field).  No problem there.

Does anyone have an idea of what might cause this difference between
the search form and the catalog?

Thanks,

-- 
Maurits van Rees | http://maurits.vanrees.org/ [NL]
            Work | http://zestsoftware.nl/
"Do not worry about your difficulties in computers,
 I can assure you mine are still greater."





More information about the Product-Developers mailing list