Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py	(revision 8404)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py	(revision 8405)
@@ -76,4 +76,5 @@
         self.login_path = 'http://localhost/app/login'
         self.root_path = 'http://localhost/app/applicants'
+        self.search_path = 'http://localhost/app/applicants/search'
         self.manage_root_path = self.root_path + '/@@manage'
         self.add_container_path = self.root_path + '/@@add'
@@ -204,4 +205,55 @@
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
         self.assertEqual(self.browser.url, self.manage_root_path)
+        return
+
+    def test_search(self):
+        # Managers can access the manage pages of applicants root
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(self.manage_path)
+        self.fill_correct_values()
+        self.browser.getControl("Save").click()
+        self.browser.open(self.root_path)
+        self.assertTrue('Manage application section' in self.browser.contents)
+        # There is a search link
+        link = self.browser.getLink('Search applicants')
+        link.click()
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        # We can find an applicant ...
+        # ... via his name
+        self.browser.getControl(name="searchtype").value = ['fullname']
+        self.browser.getControl(name="searchterm").value = 'John'
+        self.browser.getControl("Search").click()
+        self.assertTrue('John Tester' in self.browser.contents)
+        self.browser.getControl(name="searchtype").value = ['fullname']
+        self.browser.getControl(name="searchterm").value = 'Tester'
+        self.browser.getControl("Search").click()
+        self.assertTrue('John Tester' in self.browser.contents)
+        self.browser.open(self.search_path)
+        # ... and via his reg_number ...
+        self.browser.getControl(name="searchtype").value = ['reg_number']
+        self.browser.getControl(name="searchterm").value = '2345'
+        self.browser.getControl("Search").click()
+        self.assertFalse('John Tester' in self.browser.contents)
+        self.browser.getControl(name="searchtype").value = ['reg_number']
+        self.browser.getControl(name="searchterm").value = '1234'
+        self.browser.getControl("Search").click()
+        self.assertTrue('John Tester' in self.browser.contents)
+        # ... and not via his application_number ...
+        self.browser.getControl(name="searchtype").value = ['applicant_id']
+        self.browser.getControl(
+            name="searchterm").value = self.applicant.application_number
+        self.browser.getControl("Search").click()
+        self.assertFalse('John Tester' in self.browser.contents)
+        # ... but ia his applicant_id ...
+        self.browser.getControl(name="searchtype").value = ['applicant_id']
+        self.browser.getControl(
+            name="searchterm").value = self.applicant.applicant_id
+        self.browser.getControl("Search").click()
+        self.assertTrue('John Tester' in self.browser.contents)
+        # ... and via his email
+        self.browser.getControl(name="searchtype").value = ['email']
+        self.browser.getControl(name="searchterm").value = 'xx@yy.zz'
+        self.browser.getControl("Search").click()
+        self.assertTrue('John Tester' in self.browser.contents)
         return
 
@@ -408,5 +460,5 @@
             self.browser.headers['content-length'], str(PH_LEN))
 
-    def test_edit_applicant(self):
+    def test_applicant_access(self):
         # Applicants can edit their record
         self.browser.open(self.login_path)
@@ -418,4 +470,12 @@
         self.browser.getControl("Save").click()
         self.assertMatches('...Form has been saved...', self.browser.contents)
+        # Applicants don't see manage and search links ...
+        self.browser.open(self.root_path)
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertFalse('Search' in self.browser.contents)
+        self.assertFalse('Manage application section' in self.browser.contents)
+        # ... and can't access the manage page
+        self.assertRaises(
+            Unauthorized, self.browser.open, self.manage_path)
         return
 
