source: main/waeup.fceokene/branches/0.1/src/waeup/fceokene/students/tests/test_utils.py @ 13621

Last change on this file since 13621 was 9903, checked in by Henrik Bettermann, 12 years ago

Increase maximum credits.

  • 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'], 'regular_male_fr')
17        self.student['studycourse'].current_level = 200
18        acc_details  = students_utils.getAccommodationDetails(self.student)
19        self.assertEqual(acc_details['bt'], 'regular_male_re')
20        self.student['studycourse'].current_level = 300
21        acc_details  = students_utils.getAccommodationDetails(self.student)
22        self.assertEqual(acc_details['bt'], 'regular_male_fi')
23        self.student['studycourse'].current_level = 400
24        acc_details  = students_utils.getAccommodationDetails(self.student)
25        self.assertEqual(acc_details['bt'], 'regular_male_fi')
26        self.student['studycourse'].current_level = 500
27        acc_details  = students_utils.getAccommodationDetails(self.student)
28        self.assertEqual(acc_details['bt'], 'regular_male_fi')
29        return
30
31    def test_maxCreditsExceeded(self):
32        students_utils = getUtility(IStudentsUtils)
33        studylevel = grok.Container()
34        studylevel.total_credits = 40
35        course = grok.Model()
36        course.credits = 18
37        max_credits = students_utils.maxCreditsExceeded(studylevel, course)
38        self.assertEqual(max_credits, 0)
39        course.credits = 19
40        max_credits = students_utils.maxCreditsExceeded(studylevel, course)
41        self.assertEqual(max_credits, 58)
Note: See TracBrowser for help on using the repository browser.