Changeset 15574


Ignore:
Timestamp:
30 Aug 2019, 07:06:51 (5 years ago)
Author:
Henrik Bettermann
Message:

DCOEM students don't pay acceptance fee.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students
Files:
1 added
3 edited

Legend:

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

    r15404 r15574  
    3535    StudentActivateView, StudentDeactivateView,
    3636    ExportPDFTranscriptSlip,
    37     PaymentsManageFormPage)
     37    PaymentsManageFormPage,
     38    StartClearancePage)
    3839from waeup.kofa.students.workflow import (CREATED, ADMITTED, PAID,
    3940    CLEARANCE, REQUESTED, RETURNING, CLEARED, REGISTERED, VALIDATED,
     
    9596        'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
    9697
     98class CustomStartClearancePage(StartClearancePage):
     99
     100    @property
     101    def with_ac(self):
     102        if self.context.faccode == 'DCOEM':
     103            return False
     104        return True
     105
    97106class CustomStudentClearanceEditFormPage(NigeriaStudentClearanceEditFormPage):
    98107    """ View to edit student clearance data by student
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r15403 r15574  
    4545
    4646SAMPLE_FPM = os.path.join(os.path.dirname(__file__), 'sample.fpm')
     47SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
    4748
    4849class OfficerUITests(StudentsFullSetup):
     
    11671168        self.assertEqual(self.student['payments'].values()[2].amount_auth, 987.0)
    11681169        return
     1170
     1171    def test_student_clearance(self):
     1172        # create some passport file for `student`
     1173        storage = getUtility(IExtFileStore)
     1174        image_path = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
     1175        self.image_contents = open(image_path, 'rb').read()
     1176        file_id = IFileStoreNameChooser(self.student).chooseName(
     1177            attr='passport.jpg')
     1178        storage.createFile(file_id, StringIO(self.image_contents))
     1179        IWorkflowInfo(self.student).fireTransition('admit')
     1180        self.browser.open(self.login_path)
     1181        self.browser.getControl(name="form.login").value = self.student_id
     1182        self.browser.getControl(name="form.password").value = 'spwd'
     1183        self.browser.getControl("Login").click()
     1184        self.assertMatches(
     1185            '...You logged in...', self.browser.contents)
     1186        self.browser.getLink("Base Data").click()
     1187        self.browser.getLink("Download admission letter").click()
     1188        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     1189        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     1190        path = os.path.join(samples_dir(), 'admission_slip.pdf')
     1191        open(path, 'wb').write(self.browser.contents)
     1192        print "Sample PDF admission_slip.pdf written to %s" % path
     1193        self.browser.open(self.student_path + '/start_clearance')
     1194        # Regular students have to enter an access code
     1195        self.browser.getControl("Start clearance now").click()
     1196        self.assertTrue('Activation code is invalid' in self.browser.contents)
     1197        # DCOEM students can start clearance without access code
     1198        self.app['faculties']['fac1'].code = 'DCOEM'
     1199        self.browser.open(self.student_path + '/start_clearance')
     1200        self.browser.getControl("Start clearance now").click()
     1201        self.assertMatches('...Clearance process has been started...',
     1202                           self.browser.contents)
  • main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py

    r15482 r15574  
    300300            #    'MBBSMED', 'MBBSNDU', 'BSCPTY', 'BSCPST'):
    301301                amount = 80000.0
     302            elif student.faccode == 'DCOEM':
     303                return _('Acceptance fee payment not necessary.'), None
    302304            else:
    303305                amount = 60000.0
Note: See TracChangeset for help on using the changeset viewer.