# -*- coding: utf-8 -*- from waeup.kofa.testing import FunctionalTestCase from zope.component import getUtility from waeup.kofa.students.interfaces import IStudentsUtils from waeup.kofa.students.tests.test_browser import StudentsFullSetup from waeup.kwarapoly.testing import FunctionalLayer class BedAllocationTests(StudentsFullSetup): layer = FunctionalLayer def test_getAccommodationDetails(self): students_utils = getUtility(IStudentsUtils) acc_details = students_utils.getAccommodationDetails(self.student) self.assertEqual(acc_details['bt'], 'regular_male_fr') self.student['studycourse'].current_level = 200 acc_details = students_utils.getAccommodationDetails(self.student) self.assertEqual(acc_details['bt'], 'regular_male_re') self.student['studycourse'].current_level = 210 acc_details = students_utils.getAccommodationDetails(self.student) self.assertEqual(acc_details['bt'], 'regular_male_re') self.student['studycourse'].current_level = 300 acc_details = students_utils.getAccommodationDetails(self.student) self.assertEqual(acc_details['bt'], 'regular_male_fi') self.student['studycourse'].current_level = 400 acc_details = students_utils.getAccommodationDetails(self.student) self.assertEqual(acc_details['bt'], 'regular_male_fr') self.student['studycourse'].current_level = 500 acc_details = students_utils.getAccommodationDetails(self.student) self.assertEqual(acc_details['bt'], 'regular_male_re') self.student['studycourse'].current_level = 510 acc_details = students_utils.getAccommodationDetails(self.student) self.assertEqual(acc_details['bt'], 'regular_male_re') self.student['studycourse'].current_level = 600 acc_details = students_utils.getAccommodationDetails(self.student) self.assertEqual(acc_details['bt'], 'regular_male_fi') return