Ignore:
Timestamp:
8 Sep 2011, 16:35:05 (13 years ago)
Author:
Henrik Bettermann
Message:

Add student base data edit page including interfaces and page template. This page will be only used for changing the password. All other data will be readonly for students.

The browser tests fail because students are being logged out after having changed the password. This shouldn't be.

File:
1 edited

Legend:

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

    r6667 r6694  
    3939from waeup.sirp.university.faculty import Faculty
    4040from waeup.sirp.university.department import Department
     41from waeup.sirp.interfaces import IUserAccount
    4142
    4243PH_LEN = 2059  # Length of placeholder file
     
    7576        student.name = u'Anna Tester'
    7677        self.test_student_id = self.app['students'].addStudent(student)
    77 
     78        # Set password
     79        IUserAccount(self.app['students'][self.test_student_id]).setPassword('spwd')
     80
     81        self.login_path = 'http://localhost/app/login'
    7882        self.container_path = 'http://localhost/app/students'
    7983        self.manage_container_path = self.container_path + '/@@manage'
     
    244248        self.assertMatches('...Student admitted by zope.mgr...',
    245249                           self.browser.contents)
    246 
    247         return
     250        return
     251
     252    def test_student_access(self):
     253        # Students can access their own objects
     254        # and can perform actions
     255
     256        self.browser.open(self.login_path)
     257        self.browser.getControl(name="form.login").value = self.test_student_id
     258        self.browser.getControl(name="form.password").value = 'spwd'
     259        self.browser.getControl("Login").click()
     260        self.assertEqual(self.browser.url, self.student_path)
     261        self.assertTrue('You logged in' in self.browser.contents)
     262        # Change password
     263        self.browser.getLink("Change password").click()
     264        self.browser.getControl(name="form.password").value = 'new_password'
     265        self.browser.getControl("Save").click()
     266        self.assertTrue('Form has been saved' in self.browser.contents)
     267        # We are still logged in. Changing the password hasn't thrown us out.
     268        self.browser.getLink("My Data").click()
     269        self.assertEqual(self.browser.url, self.student_path)
     270        # We can logout
     271        self.browser.getLink("Logout").click()
     272        self.assertTrue('You have been logged out' in self.browser.contents)
     273        self.assertEqual(self.browser.url, 'http://localhost/app')
     274        # We can login again with the new password
     275        self.browser.getLink("Login").click()
     276        #self.browser.open(self.login_path)
     277        self.browser.getControl(name="form.login").value = self.test_student_id
     278        self.browser.getControl(name="form.password").value = 'new_password'
     279        self.browser.getControl("Login").click()
     280        self.assertEqual(self.browser.url, self.student_path)
     281        self.assertTrue('You logged in' in self.browser.contents)
     282        return
Note: See TracChangeset for help on using the changeset viewer.