Ignore:
Timestamp:
26 Oct 2012, 20:59:03 (12 years ago)
Author:
Henrik Bettermann
Message:

Link maintenance payment with bedticket. This way we can forgo a secon maint. payment category. The amount depends now on the bed really booked.

File:
1 edited

Legend:

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

    r9409 r9431  
    2828from waeup.kofa.university.department import Department
    2929from waeup.kofa.students.tests.test_browser import StudentsFullSetup
     30from waeup.kofa.students.accommodation import BedTicket
    3031from waeup.kofa.testing import FunctionalTestCase
    3132from waeup.kofa.interfaces import (
     
    8788        self.app['faculties']['SSE']['dep1'].certificates.addCertificate(
    8889            self.certificate2)
     90        # Create EET faculty with certificate
     91        self.app['faculties']['EET'] = Faculty(code='EET')
     92        self.app['faculties']['EET']['dep1'] = Department(code='dep1')
     93        self.certificate3 = createObject('waeup.Certificate')
     94        self.certificate3.code = u'CERT3'
     95        self.certificate3.application_category = 'basic'
     96        self.certificate3.study_mode = 'ug_ft'
     97        self.certificate3.start_level = 100
     98        self.certificate3.end_level = 300
     99        self.app['faculties']['EET']['dep1'].certificates.addCertificate(
     100            self.certificate3)
    89101        # Set study course attributes of test student
    90102        self.student['studycourse'].certificate = self.certificate2
     
    160172
    161173        error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
     174        self.assertEqual(error, 'You have not yet booked accommodation.')
     175        bedticket = BedTicket()
     176        bedticket.booking_session = 2004
     177        bedticket.bed_type = u'any bed type'
     178        bedticket.bed = self.app['hostels']['hall-1']['hall-1_A_101_A']
     179        bedticket.bed_coordinates = u'My bed coordinates'
     180        self.student['accommodation'].addBedTicket(bedticket)
     181        error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
    162182        self.assertEqual(payment.p_level, 100)
    163183        self.assertEqual(payment.p_session, 2004)
    164184        self.assertEqual(payment.amount_auth, 10000.0)
    165         self.assertEqual(payment.p_item, u'sse_male_fr')
    166         self.assertEqual(error, None)
    167 
    168         self.student['studycourse'].certificate = self.certificate
    169         error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
    170         self.assertEqual(payment.p_level, 100)
    171         self.assertEqual(payment.p_session, 2004)
    172         self.assertEqual(payment.amount_auth, 10000.0)
    173         self.assertEqual(payment.p_item, u'regular_male_fr')
    174         self.assertEqual(error, None)
    175 
    176         error, payment = utils.setPaymentDetails('block_h_maintenance',self.student)
     185        self.assertEqual(payment.p_item, u'My bed coordinates')
     186        self.assertEqual(error, None)
     187
     188        self.student['studycourse'].certificate = self.certificate3
     189        error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
     190        self.assertEqual(payment.p_level, 100)
     191        self.assertEqual(payment.p_session, 2004)
     192        self.assertEqual(payment.amount_auth, 12000.0)
     193        self.assertEqual(payment.p_item, u'My bed coordinates')
     194        self.assertEqual(error, None)
     195
     196        bedticket.bed.bed_id = u'block-h_anything'
     197        error, payment = utils.setPaymentDetails('hostel_maintenance',self.student)
    177198        self.assertEqual(payment.p_level, 100)
    178199        self.assertEqual(payment.p_session, 2004)
    179200        self.assertEqual(payment.amount_auth, 15000.0)
    180         self.assertEqual(payment.p_item, u'regular_male_fr')
     201        self.assertEqual(payment.p_item, u'My bed coordinates')
    181202        self.assertEqual(error, None)
    182203
Note: See TracChangeset for help on using the changeset viewer.