Index: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_browser.py
===================================================================
--- main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_browser.py	(revision 15733)
+++ main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_browser.py	(revision 15859)
@@ -35,4 +35,5 @@
     IExtFileStore, IFileStoreNameChooser)
 from waeup.kofa.students.interfaces import IStudentsUtils
+from waeup.kofa.tests.test_authentication import SECRET
 from kofacustom.iuokada.testing import FunctionalLayer
 
@@ -46,4 +47,34 @@
         return
 
+class OfficerUITests(StudentsFullSetup):
+    # Tests for Student class views and pages
+
+    layer = FunctionalLayer
+
+    def test_lib_idcard_officer(self):
+        # Create library officer
+        self.app['users'].addUser('mrlibrary', SECRET)
+        self.app['users']['mrlibrary'].email = 'library@foo.ng'
+        self.app['users']['mrlibrary'].title = 'Carlo Pitter'
+        prmglobal = IPrincipalRoleManager(self.app)
+        prmglobal.assignRoleToPrincipal(
+            'waeup.LibraryClearanceOfficer', 'mrlibrary')
+        prmglobal.assignRoleToPrincipal(
+            'waeup.StudentsOfficer', 'mrlibrary')
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = 'mrlibrary'
+        self.browser.getControl(name="form.password").value = SECRET
+        self.browser.getControl("Login").click()
+        self.assertMatches('...You logged in...', self.browser.contents)
+        self.browser.open(self.student_path)
+        self.assertFalse('Download Library Id Card' in self.browser.contents)
+        self.browser.getLink("Switch library access").click()
+        self.assertTrue('Library access enabled' in self.browser.contents)
+        self.browser.getLink("Download Library Id Card").click()
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
+        path = os.path.join(samples_dir(), 'lib_idcard_officer.pdf')
+        open(path, 'wb').write(self.browser.contents)
+        print "Sample PDF lib_idcard_officer.pdf written to %s" % path
 
 class StudentUITests(StudentsFullSetup):
@@ -72,2 +103,21 @@
         open(path, 'wb').write(self.browser.contents)
         print "Sample PDF course_registration_slip.pdf written to %s" % path
+
+    def test_library_idcard(self):
+        IWorkflowState(self.student).setState('returning')
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = self.student_id
+        self.browser.getControl(name="form.password").value = 'spwd'
+        self.browser.getControl("Login").click()
+        self.assertFalse('Library' in self.browser.contents)
+        self.student.library = True
+        self.browser.open(self.student_path)
+        self.browser.getLink("Download Library Id Card").click()
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
+        path = os.path.join(samples_dir(), 'lib_idcard_student.pdf')
+        open(path, 'wb').write(self.browser.contents)
+        print "Sample PDF lib_idcard_student.pdf written to %s" % path
+        self.assertTrue(self.student.library)
+        IWorkflowInfo(self.student).fireTransition('pay_school_fee')
+        self.assertFalse(self.student.library)
Index: main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_export.py
===================================================================
--- main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_export.py	(revision 15733)
+++ main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/tests/test_export.py	(revision 15859)
@@ -56,5 +56,5 @@
             'fst_sit_type,hq2_degree,hq2_disc,hq2_matric_no,hq2_school,'
             'hq2_session,hq2_type,hq_degree,hq_disc,hq_fname,hq_matric_no,'
-            'hq_school,hq_session,hq_type,is_staff,lastname,lga,'
+            'hq_school,hq_session,hq_type,is_staff,lastname,lga,library,'
             'marit_stat,matric_number,middlename,nationality,'
             'next_kin_address,next_kin_name,next_kin_phone,next_kin_relation,'
@@ -68,5 +68,5 @@
             '"[(\'printing_craft_practice\', \'A1\')]",my clr code,1981-02-04#,,,'
             'anna@sample.com,,,,,,,,,,,,,,Anna,,,,,,"[(\'printing_craft_practice\', \'A1\')]"'
-            ',,,,,,,,,,,,,,,,Tester,,,234,M.,NG,,,,,,,,,,'
+            ',,,,,,,,,,,,,,,,Tester,,,,234,M.,NG,,,,,,,,,,'
             '"Studentroad 21\nLagos 123456\n",,+234-123-12345#,,,123,,,,,'
             '"[(\'printing_craft_practice\', \'A1\')]",,f,A111111,0,,,created,'
