Ignore:
Timestamp:
13 Feb 2012, 15:52:13 (13 years ago)
Author:
Henrik Bettermann
Message:

Add browser test for reindex view.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7556 r7639  
    2626import grok
    2727from zope.event import notify
    28 from zope.component import createObject
     28from zope.component import createObject, queryUtility
    2929from zope.component.hooks import setSite, clearSite
     30from zope.catalog.interfaces import ICatalog
    3031from zope.security.interfaces import Unauthorized
    3132from zope.securitypolicy.interfaces import IPrincipalRoleManager
     
    16101611        self.browser.getControl("Get new login credentials").click()
    16111612        self.assertTrue('An email with' in self.browser.contents)
     1613
     1614    def test_reindex(self):
     1615        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     1616        self.browser.open('http://localhost/app/reindex')
     1617        self.assertTrue('No catalog name provided' in self.browser.contents)
     1618        self.browser.open('http://localhost/app/reindex?ctlg=xyz')
     1619        self.assertTrue('xyz_catalog does not exist' in self.browser.contents)
     1620        cat = queryUtility(ICatalog, name='students_catalog')
     1621        results = cat.searchResults(student_id=(None, None))
     1622        self.assertEqual(len(results),1)
     1623        cat.clear()
     1624        results = cat.searchResults(student_id=(None, None))
     1625        self.assertEqual(len(results),0)
     1626        self.browser.open('http://localhost/app/reindex?ctlg=students')
     1627        self.assertTrue('Students reindexed' in self.browser.contents)
     1628        results = cat.searchResults(student_id=(None, None))
     1629        self.assertEqual(len(results),1)
Note: See TracChangeset for help on using the changeset viewer.