Changeset 9402 for main/waeup.futminna/trunk/src
- Timestamp:
- 24 Oct 2012, 05:58:57 (12 years ago)
- Location:
- main/waeup.futminna/trunk/src/waeup/futminna
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.futminna/trunk/src/waeup/futminna/students/tests/test_browser.py
r9298 r9402 25 25 from zope.interface import verify 26 26 from waeup.kofa.app import University 27 from waeup.kofa.university.faculty import Faculty 28 from waeup.kofa.university.department import Department 27 29 from waeup.kofa.students.tests.test_browser import StudentsFullSetup 28 30 from waeup.kofa.testing import FunctionalTestCase … … 70 72 layer = FunctionalLayer 71 73 74 def setUp(self): 75 super(StudentUITests, self).setUp() 76 77 # Create SSE faculty with certificate 78 self.app['faculties']['SSE'] = Faculty(code='SSE') 79 self.app['faculties']['SSE']['dep1'] = Department(code='dep1') 80 self.certificate2 = createObject('waeup.Certificate') 81 self.certificate2.code = u'CERT2' 82 self.certificate2.application_category = 'basic' 83 self.certificate2.study_mode = 'ug_ft' 84 self.certificate2.start_level = 100 85 self.certificate2.end_level = 300 86 self.app['faculties']['SSE']['dep1'].certificates.addCertificate( 87 self.certificate2) 88 # Set study course attributes of test student 89 self.student['studycourse'].certificate = self.certificate2 90 self.student['studycourse'].current_session = 2004 91 self.student['studycourse'].entry_session = 2004 92 self.student['studycourse'].current_verdict = 'A' 93 self.student['studycourse'].current_level = 100 94 72 95 def test_get_returning_data(self): 73 96 # Student is in level 100, session 2004 with verdict A … … 99 122 self.assertEqual(payment.p_session, 2004) 100 123 self.assertEqual(payment.amount_auth, 37000.0) 101 self.assertEqual(payment.p_item, u'CERT 1')124 self.assertEqual(payment.p_item, u'CERT2') 102 125 self.assertEqual(error, None) 103 126 104 self.certificate .study_mode = 'jm_ft'127 self.certificate2.study_mode = 'jm_ft' 105 128 error, payment = utils.setPaymentDetails('schoolfee',self.student) 106 129 self.assertEqual(payment.amount_auth, 72700.0) … … 111 134 self.assertEqual(payment.p_session, 2005) 112 135 self.assertEqual(payment.amount_auth, 37000.0) 113 self.assertEqual(payment.p_item, u'CERT 1')136 self.assertEqual(payment.p_item, u'CERT2') 114 137 self.assertEqual(error, None) 115 138 116 self.certificate .study_mode = 'ug_ft'139 self.certificate2.study_mode = 'ug_ft' 117 140 error, payment = utils.setPaymentDetails('schoolfee',self.student) 118 141 self.assertEqual(payment.amount_auth, 20000.0) 119 120 142 121 143 error, payment = utils.setPaymentDetails('clearance',self.student) … … 123 145 self.assertEqual(payment.p_session, 2004) 124 146 self.assertEqual(payment.amount_auth, 20000.0) 125 self.assertEqual(payment.p_item, u'CERT 1')147 self.assertEqual(payment.p_item, u'CERT2') 126 148 self.assertEqual(error, None) 127 149 … … 129 151 self.assertEqual(error, u'Previous session payment not yet implemented.') 130 152 return 153 154 def test_get_accommodation_details(self): 155 self.app['configuration']['2004'].gown_fee = 150.0 156 self.app['configuration']['2004'].transfer_fee = 90.0 157 self.app['configuration']['2004'].booking_fee = 150.0 158 self.app['configuration']['2004'].maint_fee = 180.0 159 self.app['configuration']['2004'].clearance_fee = 120.0 160 utils = getUtility(IStudentsUtils) 161 162 details = utils.getAccommodationDetails(self.student) 163 self.assertEqual(details['bt'], u'sse_male_fr') -
main/waeup.futminna/trunk/src/waeup/futminna/students/utils.py
r9298 r9402 131 131 return None, payment 132 132 133 def getAccommodationDetails(self, student): 134 """Determine the accommodation data of a student. 135 """ 136 d = {} 137 d['error'] = u'' 138 hostels = grok.getSite()['hostels'] 139 d['booking_session'] = hostels.accommodation_session 140 d['allowed_states'] = hostels.accommodation_states 141 d['startdate'] = hostels.startdate 142 d['enddate'] = hostels.enddate 143 d['expired'] = hostels.expired 144 # Determine bed type 145 studycourse = student['studycourse'] 146 certificate = getattr(studycourse,'certificate',None) 147 entry_session = studycourse.entry_session 148 current_level = studycourse.current_level 149 if None in (entry_session, current_level, certificate): 150 return d 151 end_level = certificate.end_level 152 if current_level == 10: 153 bt = 'pr' 154 elif entry_session == grok.getSite()['hostels'].accommodation_session: 155 bt = 'fr' 156 elif current_level >= end_level: 157 bt = 'fi' 158 else: 159 bt = 're' 160 sex = 'male' 161 if student.sex == 'f': 162 sex = 'female' 163 special_handling = 'regular' 164 if student.faccode == 'SSE': 165 special_handling = 'sse' 166 d['bt'] = u'%s_%s_%s' % (special_handling,sex,bt) 167 return d 168 133 169 134 170 # FUTMinna prefix -
main/waeup.futminna/trunk/src/waeup/futminna/utils/utils.py
r8833 r9402 26 26 PREFERRED_LANGUAGES_DICT = { 27 27 } 28 29 SPECIAL_HANDLING_DICT = { 30 'regular': 'Regular Hostel', 31 'blocked': 'Blocked Hostel', 32 'sse': 'SSE Hostel' 33 }
Note: See TracChangeset for help on using the changeset viewer.