Changeset 7188


Ignore:
Timestamp:
25 Nov 2011, 06:54:08 (13 years ago)
Author:
Henrik Bettermann
Message:

Add test for MyRolesPage? in w.s.b.pages. Even if this page is defined in another package, it's a good place to test it.

permissions.py: Fix typo

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

Legend:

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

    r7186 r7188  
    7777class AcademicsOfficer(grok.Role):
    7878    grok.name('waeup.AcademicsOfficer')
    79     grok.title(u'Academics Offiver (view only)')
     79    grok.title(u'Academics Officer (view only)')
    8080    grok.permissions('waeup.viewAcademics')
    8181
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r7158 r7188  
    1 ##
    2 ## test_browser.py
    3 ## Login : <uli@pu.smp.net>
    4 ## Started on  Tue Mar 29 11:31:11 2011 Uli Fouquet
    51## $Id$
    62##
     
    4238from waeup.sirp.university.department import Department
    4339from waeup.sirp.interfaces import IUserAccount
     40from waeup.sirp.authentication import LocalRoleSetEvent
    4441from waeup.sirp.hostels.hostel import Hostel, Bed, NOT_OCCUPIED
    4542
     
    647644        # Create clearance officer
    648645        self.app['users'].addUser('mrclear', 'mrclearsecret')
     646        # Clearance officers need to get the StudentsOfficer site role
    649647        prmglobal = IPrincipalRoleManager(self.app)
    650648        prmglobal.assignRoleToPrincipal('waeup.StudentsOfficer', 'mrclear')
    651         prmlocal = IPrincipalRoleManager(self.app['faculties']['fac1']['dep1'])
     649        # Assign local ClearanceOfficer role
     650        department = self.app['faculties']['fac1']['dep1']
     651        prmlocal = IPrincipalRoleManager(department)
    652652        prmlocal.assignRoleToPrincipal('waeup.local.ClearanceOfficer', 'mrclear')
    653653        IWorkflowInfo(self.student).fireTransition('admit')
     
    659659        self.browser.getControl("Login").click()
    660660        self.assertTrue('You logged in' in self.browser.contents)
     661        # CO can see his roles
     662        self.browser.getLink("My Roles").click()
     663        self.assertMatches(
     664            '...<div>Academics Officer (view only)</div>...',
     665            self.browser.contents)
     666        self.assertMatches(
     667            '...<div>Students Officer (view only)</div>...',
     668            self.browser.contents)
     669        # But not his local role ...
     670        self.assertFalse('Clearance Officer' in self.browser.contents)
     671        # ... because we forgot to notify the department that the local role
     672        # has changed
     673        notify(LocalRoleSetEvent(
     674            department, 'waeup.local.ClearanceOfficer', 'mrclear', granted=True))
     675        self.browser.open('http://localhost/app/users/mrclear/my_roles')
     676        self.assertTrue('Clearance Officer' in self.browser.contents)
     677        self.assertMatches(
     678            '...<a href="http://localhost/app/faculties/fac1/dep1">...',
     679            self.browser.contents)
     680        # CO can view the student
    661681        self.browser.open(self.clearance_student_path)
    662682        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    663683        self.assertEqual(self.browser.url, self.clearance_student_path)
    664         # Only in state clearance requested the co does see the 'Clear' button
     684        # Only in state clearance requested the CO does see the 'Clear' button
    665685        self.assertFalse('Clear student' in self.browser.contents)
    666686        IWorkflowInfo(self.student).fireTransition('request_clearance')
     
    681701        self.assertTrue('State: <span>clearance started</span>'
    682702            in self.browser.contents)
    683         # The clearance officer can't clear students if not in state
     703        # The CO can't clear students if not in state
    684704        # clearance requested
    685705        self.browser.open(self.student_path + '/clear')
Note: See TracChangeset for help on using the changeset viewer.