source: main/waeup.fceokene/trunk/src/waeup/fceokene/students/tests/test_utils.py @ 14086

Last change on this file since 14086 was 13614, checked in by Henrik Bettermann, 9 years ago

Add special_handling code 'ugft' and allocate bed space accordingly.

  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1# -*- coding: utf-8 -*-
2import grok
3from waeup.kofa.testing import FunctionalTestCase
4from zope.component import getUtility
5from waeup.kofa.students.interfaces import IStudentsUtils
6from waeup.kofa.students.tests.test_browser import StudentsFullSetup
7from waeup.fceokene.testing import FunctionalLayer
8
9class BedAllocationTests(StudentsFullSetup):
10
11    layer = FunctionalLayer
12
13    def test_getAccommodationDetails(self):
14        students_utils = getUtility(IStudentsUtils)
15        acc_details  = students_utils.getAccommodationDetails(self.student)
16        self.assertEqual(acc_details['bt'], 'ugft_male_fr')
17        self.student['studycourse'].current_level = 200
18        self.certificate.study_mode = 'ug_pt'
19        acc_details  = students_utils.getAccommodationDetails(self.student)
20        self.assertEqual(acc_details['bt'], 'regular_male_re')
21        self.student['studycourse'].current_level = 300
22        acc_details  = students_utils.getAccommodationDetails(self.student)
23        self.assertEqual(acc_details['bt'], 'regular_male_fi')
24        self.student['studycourse'].current_level = 400
25        acc_details  = students_utils.getAccommodationDetails(self.student)
26        self.assertEqual(acc_details['bt'], 'regular_male_fi')
27        self.student['studycourse'].current_level = 500
28        acc_details  = students_utils.getAccommodationDetails(self.student)
29        self.assertEqual(acc_details['bt'], 'regular_male_fi')
30        return
31
32    def test_maxCreditsExceeded(self):
33        students_utils = getUtility(IStudentsUtils)
34        studylevel = grok.Container()
35        studylevel.total_credits = 40
36        course = grok.Model()
37        course.credits = 18
38        max_credits = students_utils.maxCreditsExceeded(studylevel, course)
39        self.assertEqual(max_credits, 0)
40        course.credits = 19
41        max_credits = students_utils.maxCreditsExceeded(studylevel, course)
42        self.assertEqual(max_credits, 58)
Note: See TracBrowser for help on using the repository browser.