Ignore:
Timestamp:
28 Nov 2019, 08:21:23 (5 years ago)
Author:
Henrik Bettermann
Message:

Implement library clearance facilities.

Location:
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_browser.py

    r15696 r15859  
    3535    IExtFileStore, IFileStoreNameChooser)
    3636from waeup.kofa.students.interfaces import IStudentsUtils
     37from waeup.kofa.tests.test_authentication import SECRET
    3738from kofacustom.iuokada.testing import FunctionalLayer
    3839
     
    4647        return
    4748
     49class OfficerUITests(StudentsFullSetup):
     50    # Tests for Student class views and pages
     51
     52    layer = FunctionalLayer
     53
     54    def test_lib_idcard_officer(self):
     55        # Create library officer
     56        self.app['users'].addUser('mrlibrary', SECRET)
     57        self.app['users']['mrlibrary'].email = 'library@foo.ng'
     58        self.app['users']['mrlibrary'].title = 'Carlo Pitter'
     59        prmglobal = IPrincipalRoleManager(self.app)
     60        prmglobal.assignRoleToPrincipal(
     61            'waeup.LibraryClearanceOfficer', 'mrlibrary')
     62        prmglobal.assignRoleToPrincipal(
     63            'waeup.StudentsOfficer', 'mrlibrary')
     64        self.browser.open(self.login_path)
     65        self.browser.getControl(name="form.login").value = 'mrlibrary'
     66        self.browser.getControl(name="form.password").value = SECRET
     67        self.browser.getControl("Login").click()
     68        self.assertMatches('...You logged in...', self.browser.contents)
     69        self.browser.open(self.student_path)
     70        self.assertFalse('Download Library Id Card' in self.browser.contents)
     71        self.browser.getLink("Switch library access").click()
     72        self.assertTrue('Library access enabled' in self.browser.contents)
     73        self.browser.getLink("Download Library Id Card").click()
     74        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     75        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     76        path = os.path.join(samples_dir(), 'lib_idcard_officer.pdf')
     77        open(path, 'wb').write(self.browser.contents)
     78        print "Sample PDF lib_idcard_officer.pdf written to %s" % path
    4879
    4980class StudentUITests(StudentsFullSetup):
     
    72103        open(path, 'wb').write(self.browser.contents)
    73104        print "Sample PDF course_registration_slip.pdf written to %s" % path
     105
     106    def test_library_idcard(self):
     107        IWorkflowState(self.student).setState('returning')
     108        self.browser.open(self.login_path)
     109        self.browser.getControl(name="form.login").value = self.student_id
     110        self.browser.getControl(name="form.password").value = 'spwd'
     111        self.browser.getControl("Login").click()
     112        self.assertFalse('Library' in self.browser.contents)
     113        self.student.library = True
     114        self.browser.open(self.student_path)
     115        self.browser.getLink("Download Library Id Card").click()
     116        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     117        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     118        path = os.path.join(samples_dir(), 'lib_idcard_student.pdf')
     119        open(path, 'wb').write(self.browser.contents)
     120        print "Sample PDF lib_idcard_student.pdf written to %s" % path
     121        self.assertTrue(self.student.library)
     122        IWorkflowInfo(self.student).fireTransition('pay_school_fee')
     123        self.assertFalse(self.student.library)
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_export.py

    r15733 r15859  
    5656            'fst_sit_type,hq2_degree,hq2_disc,hq2_matric_no,hq2_school,'
    5757            'hq2_session,hq2_type,hq_degree,hq_disc,hq_fname,hq_matric_no,'
    58             'hq_school,hq_session,hq_type,is_staff,lastname,lga,'
     58            'hq_school,hq_session,hq_type,is_staff,lastname,lga,library,'
    5959            'marit_stat,matric_number,middlename,nationality,'
    6060            'next_kin_address,next_kin_name,next_kin_phone,next_kin_relation,'
     
    6868            '"[(\'printing_craft_practice\', \'A1\')]",my clr code,1981-02-04#,,,'
    6969            'anna@sample.com,,,,,,,,,,,,,,Anna,,,,,,"[(\'printing_craft_practice\', \'A1\')]"'
    70             ',,,,,,,,,,,,,,,,Tester,,,234,M.,NG,,,,,,,,,,'
     70            ',,,,,,,,,,,,,,,,Tester,,,,234,M.,NG,,,,,,,,,,'
    7171            '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,,,123,,,,,'
    7272            '"[(\'printing_craft_practice\', \'A1\')]",,f,A111111,0,,,created,'
Note: See TracChangeset for help on using the changeset viewer.