Ignore:
Timestamp:
2 Oct 2011, 08:15:51 (13 years ago)
Author:
Henrik Bettermann
Message:

Do not return the student_id when calling addStudent. The student_id is now set when a student is initiated.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
2 edited

Legend:

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

    r6838 r6845  
    4545                'StudentsContainers contain only IStudent instances')
    4646        self[student.student_id] = student
    47         # Return student_id (only needed in tests)
    48         return student.student_id
     47        return
    4948
    5049    logger_name = 'waeup.sirp.${sitename}.students'
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r6818 r6845  
    7474        student.reg_number = u'123'
    7575        student.matric_number = u'234'
    76         self.test_student_id = self.app['students'].addStudent(student)
    77         self.student = self.app['students'][self.test_student_id]
     76        self.app['students'].addStudent(student)
     77        self.student_id = student.student_id
     78        self.student = self.app['students'][self.student_id]
    7879
    7980        # Set password
    8081        IUserAccount(
    81             self.app['students'][self.test_student_id]).setPassword('spwd')
     82            self.app['students'][self.student_id]).setPassword('spwd')
    8283
    8384        self.login_path = 'http://localhost/app/login'
     
    8586        self.manage_container_path = self.container_path + '/@@manage'
    8687        self.add_student_path = self.container_path + '/addstudent'
    87         self.student_path = self.container_path + '/' + self.test_student_id
     88        self.student_path = self.container_path + '/' + self.student_id
    8889        self.manage_student_path = self.student_path + '/edit_base'
    8990        self.clearance_student_path = self.student_path + '/view_clearance'
     
    206207        self.assertTrue('Empty search string' in self.browser.contents)
    207208        self.browser.getControl(name="searchtype").value = ['student_id']
    208         self.browser.getControl(name="searchterm").value = self.test_student_id
     209        self.browser.getControl(name="searchterm").value = self.student_id
    209210        self.browser.getControl("Search").click()
    210211        self.assertTrue('Anna Tester' in self.browser.contents)
     
    222223
    223224        ctrl = self.browser.getControl(name='entries')
    224         ctrl.getControl(value=self.test_student_id).selected = True
     225        ctrl.getControl(value=self.student_id).selected = True
    225226        self.browser.getControl("Remove selected", index=0).click()
    226227        self.assertTrue('Successfully removed' in self.browser.contents)
    227228        self.browser.getControl(name="searchtype").value = ['student_id']
    228         self.browser.getControl(name="searchterm").value = self.test_student_id
     229        self.browser.getControl(name="searchterm").value = self.student_id
    229230        self.browser.getControl("Search").click()
    230231        self.assertTrue('No student found' in self.browser.contents)
     
    232233        self.browser.open(self.container_path)
    233234        self.browser.getControl(name="searchtype").value = ['student_id']
    234         self.browser.getControl(name="searchterm").value = self.test_student_id
     235        self.browser.getControl(name="searchterm").value = self.student_id
    235236        self.browser.getControl("Search").click()
    236237        self.assertTrue('No student found' in self.browser.contents)
     
    354355        # Managers can pass through the whole workflow
    355356        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    356         student = self.app['students'][self.test_student_id]
     357        student = self.app['students'][self.student_id]
    357358        self.browser.open(self.manage_student_path)
    358359        self.assertTrue(student.clearance_locked)
     
    391392        # Students can change the password
    392393        self.browser.open(self.login_path)
    393         self.browser.getControl(name="form.login").value = self.test_student_id
     394        self.browser.getControl(name="form.login").value = self.student_id
    394395        self.browser.getControl(name="form.password").value = 'spwd'
    395396        self.browser.getControl("Login").click()
     
    418419        self.browser.getLink("Login").click()
    419420        self.browser.open(self.login_path)
    420         self.browser.getControl(name="form.login").value = self.test_student_id
     421        self.browser.getControl(name="form.login").value = self.student_id
    421422        self.browser.getControl(name="form.password").value = 'new_password'
    422423        self.browser.getControl("Login").click()
     
    430431        student.reg_number = u'123456'
    431432        student.fullname = u'Klaus Tester'
    432         test_student_id = self.app['students'].addStudent(student)
     433        self.app['students'].addStudent(student)
    433434        setpassword_path = 'http://localhost/app/setpassword'
    434         student_path = 'http://localhost/app/students/%s' % test_student_id
     435        student_path = 'http://localhost/app/students/%s' % student.student_id
    435436        self.browser.open(setpassword_path)
    436437        self.browser.getControl(name="ac_series").value = self.existing_pwdseries
     
    465466        # The student can login with the new credentials
    466467        self.browser.open(self.login_path)
    467         self.browser.getControl(name="form.login").value = test_student_id
     468        self.browser.getControl(name="form.login").value = student.student_id
    468469        self.browser.getControl(
    469470            name="form.password").value = self.existing_pwdnumber
     
    476477        # Students can access their own objects
    477478        # and can perform actions
    478         student = self.app['students'][self.test_student_id]
     479        student = self.app['students'][self.student_id]
    479480        IWorkflowInfo(student).fireTransition('admit')
    480481        self.browser.open(self.login_path)
    481         self.browser.getControl(name="form.login").value = self.test_student_id
     482        self.browser.getControl(name="form.login").value = self.student_id
    482483        self.browser.getControl(name="form.password").value = 'spwd'
    483484        self.browser.getControl("Login").click()
Note: See TracChangeset for help on using the changeset viewer.