Ignore:
Timestamp:
25 Aug 2011, 12:01:37 (13 years ago)
Author:
Henrik Bettermann
Message:

Add students_catalog and search facilities.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students/tests
Files:
1 added
1 edited

Legend:

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

    r6622 r6626  
    7373        self.container_path = 'http://localhost/app/students'
    7474        self.manage_container_path = self.container_path + '/@@manage'
    75         self.add_student_path = self.container_path + '/@@add'
     75        self.add_student_path = self.container_path + '/addstudent'
    7676
    7777        # Populate university
     
    121121        return
    122122
    123     def test_add_students(self):
    124         # Managers can add students
     123    def test_add_search_delete_students(self):
     124        # Managers can add search and remove students
    125125        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    126         self.add_student_path = self.container_path + '/addstudent'
    127         self.container_manage_path = self.container_path + '/@@manage'
    128         self.browser.open(self.container_manage_path)
    129         self.browser.getControl("Add student").click()
     126        self.browser.open(self.manage_container_path)
     127        self.browser.getLink("Add student").click()
    130128        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    131129        self.assertEqual(self.browser.url, self.add_student_path)
     
    133131        self.browser.getControl(name="form.name").value = 'Bob Tester'
    134132        self.browser.getControl("Create student record").click()
     133        self.assertTrue('Student record created' in self.browser.contents)
     134
     135        self.browser.open(self.container_path)
     136        self.browser.getControl("Search").click()
     137        self.assertTrue('Empty search string' in self.browser.contents)
     138        self.browser.getControl(name="searchtype").value = ['student_id']
     139        self.browser.getControl(name="searchterm").value = 'A123456'
     140        self.browser.getControl("Search").click()
     141        self.assertTrue('Bob Tester' in self.browser.contents)
     142        # The old searchterm will be used again
     143        self.browser.getControl("Search").click()
     144        self.assertTrue('Bob Tester' in self.browser.contents)
     145
     146        self.browser.open(self.manage_container_path)
     147        self.browser.getControl("Search").click()
     148        self.assertTrue('Empty search string' in self.browser.contents)
     149        self.browser.getControl(name="searchtype").value = ['name']
     150        self.browser.getControl(name="searchterm").value = 'Bob Tester'
     151        self.browser.getControl("Search").click()
     152        self.assertTrue('A123456' in self.browser.contents)
     153        ctrl = self.browser.getControl(name='entries')
     154        ctrl.getControl(value='A123456').selected = True
     155        self.browser.getControl("Remove selected", index=0).click()
     156        self.assertTrue('Successfully removed' in self.browser.contents)
     157        self.browser.getControl(name="searchtype").value = ['student_id']
     158        self.browser.getControl(name="searchterm").value = 'A123456'
     159        self.browser.getControl("Search").click()
     160        self.assertTrue('No student found' in self.browser.contents)
     161
     162        self.browser.open(self.container_path)
     163        self.browser.getControl(name="searchtype").value = ['student_id']
     164        self.browser.getControl(name="searchterm").value = 'A123456'
     165        self.browser.getControl("Search").click()
     166        self.assertTrue('No student found' in self.browser.contents)
     167
Note: See TracChangeset for help on using the changeset viewer.