Back to index

plone3  3.1.7
test_sharing_view.py
Go to the documentation of this file.
00001 #
00002 # Test the sharing browser view.
00003 #
00004 
00005 from zope.component import getMultiAdapter
00006 
00007 from base import WorkflowTestCase
00008 
00009 
00010 class TestSharingView(WorkflowTestCase):
00011 
00012     def afterSetUp(self):
00013         self.portal.acl_users._doAddUser('testuser', 'secret', ['Member'], [])
00014         self.loginAsPortalOwner()
00015 
00016     def test_search_by_login_name(self):
00017         """Make sure we can search by login name on the Sharing tab.
00018         
00019         Prevents regressions of #6853.
00020         """
00021         request = self.app.REQUEST
00022         request.form['search_term'] = 'testuser'
00023         view = getMultiAdapter((self.portal, request), name='sharing')
00024         results = view.user_search_results()
00025         self.failUnless(len(results) and results[0].get('id') == 'testuser', msg="Didn't find testuser when I searched by login name.")
00026 
00027 
00028 def test_suite():
00029     from unittest import TestSuite, makeSuite
00030     suite = TestSuite()
00031     suite.addTest(makeSuite(TestSharingView))
00032     return suite