Ignore:
Timestamp:
16 Jun 2015, 13:31:37 (10 years ago)
Author:
Henrik Bettermann
Message:

Rename views according to changes in base package.

Add test_manage_payments_bypass_ac_creation.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py

    r13051 r13059  
    2929    CourseTicketAddFormPage,
    3030    StudyLevelDisplayFormPage,
    31     ExportPDFTranscriptPage,
    32     ExportPDFAdmissionSlipPage,
     31    ExportPDFTranscriptSlip,
     32    ExportPDFAdmissionSlip,
    3333    )
    3434from kofacustom.nigeria.students.browser import (
    3535    NigeriaOnlinePaymentDisplayFormPage,
    3636    NigeriaOnlinePaymentAddFormPage,
    37     NigeriaExportPDFPaymentSlipPage,
    38     NigeriaExportPDFCourseRegistrationSlipPage,
    39     NigeriaExportPDFClearanceSlipPage,
     37    NigeriaExportPDFPaymentSlip,
     38    NigeriaExportPDFCourseRegistrationSlip,
     39    NigeriaExportPDFClearanceSlip,
    4040    )
    4141from waeup.aaue.students.interfaces import (
     
    6565        'p_category')
    6666
    67 class CustomExportPDFPaymentSlipPage(NigeriaExportPDFPaymentSlipPage):
     67class CustomExportPDFPaymentSlip(NigeriaExportPDFPaymentSlip):
    6868    """Deliver a PDF slip of the context.
    6969    """
     
    9393        'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    9494
    95 class CustomExportPDFCourseRegistrationSlipPage(
    96     NigeriaExportPDFCourseRegistrationSlipPage):
     95class CustomExportPDFCourseRegistrationSlip(
     96    NigeriaExportPDFCourseRegistrationSlip):
    9797    """Deliver a PDF slip of the context.
    9898    """
     
    190190            )
    191191
    192 class CustomExportPDFTranscriptPage(ExportPDFTranscriptPage):
     192class CustomExportPDFTranscriptSlip(ExportPDFTranscriptSlip):
    193193    """Deliver a PDF slip of the context.
    194194    """
     
    202202            'Exams, Records and Data Processing Division <br /> For: Registrar')],)
    203203
    204 class CustomExportPDFAdmissionSlipPage(ExportPDFAdmissionSlipPage):
     204class CustomExportPDFAdmissionSlip(ExportPDFAdmissionSlip):
    205205    """Deliver a PDF Admission slip.
    206206    """
     
    213213            + ' %s' % self.context.display_fullname
    214214
    215 class CustomExportPDFClearanceSlipPage(NigeriaExportPDFClearanceSlipPage):
     215class CustomExportPDFClearanceSlip(NigeriaExportPDFClearanceSlip):
    216216    """Deliver a PDF slip of the context.
    217217    """
     
    245245        return
    246246
    247 class ExportPDFMatricNumberSlipPage(UtilityView, grok.View):
     247class ExportPDFMatricNumberSlip(UtilityView, grok.View):
    248248    """Deliver a PDF notification slip.
    249249    """
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r13051 r13059  
    2525from hurry.workflow.interfaces import IWorkflowState
    2626from zope.component.hooks import setSite, clearSite
    27 from zope.component import getUtility, createObject
     27from zope.component import getUtility, createObject, queryUtility
     28from zope.catalog.interfaces import ICatalog
    2829from waeup.kofa.app import University
    2930from waeup.kofa.students.tests.test_browser import StudentsFullSetup
     
    99100        return
    100101
    101 class StudentUITests(StudentsFullSetup):
    102     """Tests for customized student class views and pages
    103     """
    104 
    105     layer = FunctionalLayer
    106 
    107     def setUp(self):
    108         super(StudentUITests, self).setUp()
    109 
    110         bedticket = BedTicket()
    111         bedticket.booking_session = 2004
    112         bedticket.bed_type = u'any bed type'
    113         bedticket.bed = self.app['hostels']['hall-1']['hall-1_A_101_A']
    114         bedticket.bed_coordinates = u'My bed coordinates'
    115         self.student['accommodation'].addBedTicket(bedticket)
    116 
    117102    def test_manage_payments(self):
    118103        # Add missing configuration data
     
    245230        self.assertMatches('...Session configuration object is not...',
    246231                           self.browser.contents)
     232
     233    def test_manage_payments_bypass_ac_creation(self):
     234        self.app['configuration']['2004'].school_fee_1 = 6666.0
     235        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     236        self.browser.open(self.payments_path)
     237        IWorkflowState(self.student).setState('cleared')
     238        self.browser.getLink("Add current session payment ticket").click()
     239        self.browser.getControl(name="form.p_category").value = ['schoolfee']
     240        self.browser.getControl("Create ticket").click()
     241        ctrl = self.browser.getControl(name='val_id')
     242        value = ctrl.options[0]
     243        self.browser.getLink(value).click()
     244        payment_url = self.browser.url
     245        logfile = os.path.join(
     246            self.app['datacenter'].storage, 'logs', 'students.log')
     247        # The ticket can be found in the payments_catalog
     248        cat = queryUtility(ICatalog, name='payments_catalog')
     249        results = list(cat.searchResults(p_state=('unpaid', 'unpaid')))
     250        self.assertTrue(len(results), 1)
     251        self.assertTrue(results[0] is self.student['payments'][value])
     252        # Managers can approve the payment
     253        self.browser.open(payment_url)
     254        self.browser.getLink("Approve payment").click()
     255        self.assertMatches('...Payment approved...',
     256                          self.browser.contents)
     257        # Approval is logged in students.log ...
     258        logcontent = open(logfile).read()
     259        self.assertTrue(
     260            'zope.mgr - students.browser.OnlinePaymentApproveView '
     261            '- E1000000 - schoolfee payment approved'
     262            in logcontent)
     263        # ... and in payments.log
     264        logfile = os.path.join(
     265            self.app['datacenter'].storage, 'logs', 'payments.log')
     266        logcontent = open(logfile).read()
     267        self.assertTrue(
     268            '"zope.mgr",E1000000,%s,schoolfee,6666.0,AP,,,,,,\n' % value
     269            in logcontent)
     270        # Student is in state school fee paid, no activation
     271        # code was necessary.
     272        self.assertEqual(self.student.state, 'school fee paid')
     273        self.assertEqual(len(self.app['accesscodes']['SFE-0']),0)
     274        return
     275
     276class StudentUITests(StudentsFullSetup):
     277    """Tests for customized student class views and pages
     278    """
     279
     280    layer = FunctionalLayer
     281
     282    def setUp(self):
     283        super(StudentUITests, self).setUp()
     284
     285        bedticket = BedTicket()
     286        bedticket.booking_session = 2004
     287        bedticket.bed_type = u'any bed type'
     288        bedticket.bed = self.app['hostels']['hall-1']['hall-1_A_101_A']
     289        bedticket.bed_coordinates = u'My bed coordinates'
     290        self.student['accommodation'].addBedTicket(bedticket)
    247291
    248292    def test_student_payments(self):
Note: See TracChangeset for help on using the changeset viewer.