Ignore:
Timestamp:
25 Mar 2019, 17:59:03 (6 years ago)
Author:
Henrik Bettermann
Message:

Implement a library access switch.

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

Legend:

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

    r15352 r15371  
    4141    IExtFileStore, IFileStoreNameChooser)
    4242from waeup.kofa.students.interfaces import IStudentsUtils
     43from waeup.kofa.tests.test_authentication import SECRET
    4344from waeup.uniben.testing import FunctionalLayer
    4445
    4546SAMPLE_FPM = os.path.join(os.path.dirname(__file__), 'sample.fpm')
     47
     48class OfficerUITests(StudentsFullSetup):
     49    # Tests for Student class views and pages
     50
     51    layer = FunctionalLayer
     52
     53    def test_jhl_idcard_officer(self):
     54        # Create library officer
     55        self.app['users'].addUser('mrlibrary', SECRET)
     56        self.app['users']['mrlibrary'].email = 'library@foo.ng'
     57        self.app['users']['mrlibrary'].title = 'Carlo Pitter'
     58        prmglobal = IPrincipalRoleManager(self.app)
     59        prmglobal.assignRoleToPrincipal(
     60            'waeup.LibraryClearanceOfficer', 'mrlibrary')
     61        prmglobal.assignRoleToPrincipal(
     62            'waeup.StudentsOfficer', 'mrlibrary')
     63        self.browser.open(self.login_path)
     64        self.browser.getControl(name="form.login").value = 'mrlibrary'
     65        self.browser.getControl(name="form.password").value = SECRET
     66        self.browser.getControl("Login").click()
     67        self.assertMatches('...You logged in...', self.browser.contents)
     68        self.browser.open(self.student_path)
     69        self.assertFalse('JHL' in self.browser.contents)
     70        self.browser.getLink("Switch library access").click()
     71        self.assertTrue('Library access enabled' in self.browser.contents)
     72        self.assertTrue('JHL' in self.browser.contents)
     73        self.browser.getLink("Download JHL 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(), 'jhl_idcard_officer.pdf')
     77        open(path, 'wb').write(self.browser.contents)
     78        print "Sample PDF jhl_idcard_officer.pdf written to %s" % path
    4679
    4780class StudentUITests(StudentsFullSetup):
     
    219252        self.browser.getControl(name="form.password").value = 'spwd'
    220253        self.browser.getControl("Login").click()
     254        self.assertFalse('JHL' in self.browser.contents)
     255        self.student.library = True
     256        self.browser.open(self.student_path)
     257        self.assertTrue('JHL' in self.browser.contents)
    221258        self.browser.getLink("Download JHL Id Card").click()
    222259        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    223260        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
    224         path = os.path.join(samples_dir(), 'jhl_idcard.pdf')
     261        path = os.path.join(samples_dir(), 'jhl_idcard_student.pdf')
    225262        open(path, 'wb').write(self.browser.contents)
    226         print "Sample PDF jhl_idcard.pdf written to %s" % path
     263        print "Sample PDF jhl_idcard_student.pdf written to %s" % path
    227264
    228265    def test_jupeb_result_slip(self):
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_export.py

    r14853 r15371  
    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.