Ignore:
Timestamp:
10 Jul 2012, 05:39:02 (12 years ago)
Author:
Henrik Bettermann
Message:

Check for new local roles and assign StudentsClearanceOfficer? role accordingly.

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

Legend:

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

    r8920 r8963  
    15571557                           self.browser.contents)
    15581558        # Payment session and level are current ones.
    1559         # Postgrads have to school_fee_1.
     1559        # Postgrads have to pay school_fee_1.
    15601560        self.assertEqual(self.student['payments'][value].amount_auth, 40000.0)
    15611561        self.assertEqual(self.student['payments'][value].p_session, 2004)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_dynamicroles.py

    r7811 r8963  
    2525    Test as APRMTest, Manageable)
    2626from waeup.kofa.testing import FunctionalLayer
     27from waeup.kofa.app import University
    2728from waeup.kofa.students.tests.test_browser import StudentsFullSetup
    2829from waeup.kofa.students import Student, StudentPrincipalRoleManager
     
    4849    def setUp(self):
    4950        super(StudentPrincipalRoleManagerFunctionalTests, self).setUp()
    50         self.officer_role = 'waeup.StudentsClearanceOfficer'
    5151        # assign clearance permissions for a virtual officer
    5252        prm = IPrincipalRoleManager(self.app['faculties']['fac1']['dep1'])
    5353        prm.assignRoleToPrincipal('waeup.local.ClearanceOfficer', 'alice')
     54        prm.assignRoleToPrincipal('waeup.local.PGClearanceOfficer', 'bob')
     55        prm.assignRoleToPrincipal('waeup.local.UGClearanceOfficer', 'anne')
    5456        return
    5557
     
    7476        # student
    7577        prm = IPrincipalRoleManager(self.student)
    76         result = prm.getRolesForPrincipal('bob')
     78        result = prm.getRolesForPrincipal('claus')
    7779        self.assertEqual(result, [])
    7880        return
     
    8385        prm = IPrincipalRoleManager(self.student)
    8486        result = prm.getRolesForPrincipal('alice')
    85         self.assertEqual(result, [(self.officer_role, Allow)])
     87        self.assertEqual(result, [('waeup.StudentsClearanceOfficer', Allow)])
     88        # Student is a UG student
     89        self.assertFalse(self.student.is_postgrad)
     90        result = prm.getRolesForPrincipal('bob')
     91        self.assertEqual(result, [('waeup.StudentsOfficer', Allow)])
     92        result = prm.getRolesForPrincipal('anne')
     93        self.assertEqual(result, [('waeup.StudentsClearanceOfficer', Allow)])
     94        # Make student a PG student
     95        self.certificate.study_mode = u'pg_ft'
     96        self.assertTrue(self.student.is_postgrad)
     97        result = prm.getRolesForPrincipal('bob')
     98        # The dynamic roles changed
     99        self.assertEqual(result, [('waeup.StudentsClearanceOfficer', Allow)])
     100        result = prm.getRolesForPrincipal('anne')
     101        self.assertEqual(result, [('waeup.StudentsOfficer', Allow)])
    86102        return
Note: See TracChangeset for help on using the changeset viewer.