Ignore:
Timestamp:
16 Jan 2016, 18:26:12 (9 years ago)
Author:
Henrik Bettermann
Message:

Implement bursary clearance slip.

File:
1 edited

Legend:

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

    r13620 r13623  
    1919import shutil
    2020import tempfile
     21from time import time
    2122from datetime import datetime, timedelta
    2223from StringIO import StringIO
     
    3536from waeup.kofa.students.batching import StudentProcessor
    3637from waeup.kofa.students.interfaces import IStudentsUtils
     38from waeup.kofa.browser.tests.test_pdf import samples_dir
    3739from kofacustom.nigeria.students.batching import NigeriaStudentProcessor
    3840from kofacustom.nigeria.testing import FunctionalLayer
     
    417419            '...2016-01-16 15:50:48 WAT - Financial clearance withdrawn by Carlo Pitter...',
    418420            self.browser.contents)
     421
     422    def test_bursary_pdf_slip(self):
     423        payment1 = createObject(u'waeup.StudentOnlinePayment')
     424        timestamp = ("%d" % int(time()*10000))[1:]
     425        payment1.p_id = "p%s" % timestamp
     426        payment1.p_category = 'schoolfee'
     427        payment1.p_item = u'My School Fee'
     428        payment1.p_session = 2015
     429        payment1.p_level = 100
     430        payment1.p_current = True
     431        payment1.amount_auth = 23456.9
     432        payment1.approve()
     433        payment2 = createObject(u'waeup.StudentOnlinePayment')
     434        timestamp = ("%d" % int(time()*10000))[1:]
     435        payment2.p_id = "p%s" % timestamp
     436        payment2.p_category = 'clearance'
     437        payment2.p_item = u'My Clearance Fee'
     438        payment2.p_session = 2015
     439        payment2.p_level = 100
     440        payment2.p_current = True
     441        payment2.amount_auth = 5678.6
     442        payment2.approve()
     443        self.student['payments'][payment1.p_id] = payment1
     444        self.student['payments'][payment2.p_id] = payment2
     445        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     446        self.browser.open(self.student_path + '/clear_financially')
     447        self.browser.getLink("Download bursary clearance slip").click()
     448        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     449        self.assertEqual(self.browser.headers['Content-Type'],
     450                         'application/pdf')
     451        path = os.path.join(samples_dir(), 'bursary_clearance_slip.pdf')
     452        open(path, 'wb').write(self.browser.contents)
     453        print "Sample PDF bursary_clearance_slip.pdf written to %s" % path
     454        return
Note: See TracChangeset for help on using the changeset viewer.