Ignore:
Timestamp:
25 Feb 2017, 17:59:16 (8 years ago)
Author:
Henrik Bettermann
Message:

Customize warnCreditsOOR and IStudentStudyLevel.

Location:
main/waeup.fceokene/trunk/src/waeup/fceokene/students/tests
Files:
2 edited

Legend:

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

    r14406 r14591  
    2929from waeup.kofa.students.accommodation import BedTicket
    3030from waeup.kofa.testing import FunctionalTestCase
     31from waeup.kofa.browser.tests.test_pdf import samples_dir
    3132from waeup.kofa.interfaces import (
    3233    IExtFileStore, IFileStoreNameChooser)
     
    416417                           self.browser.contents)
    417418        return
     419
     420    def test_student_course_registration(self):
     421        IWorkflowState(self.student).setState('school fee paid')
     422        self.browser.open(self.login_path)
     423        self.browser.getControl(name="form.login").value = self.student_id
     424        self.browser.getControl(name="form.password").value = 'spwd'
     425        self.browser.getControl("Login").click()
     426        # Now students can add the current study level
     427        self.browser.getLink("Study Course").click()
     428        self.browser.getLink("Add course list").click()
     429        self.assertMatches('...Add current level 100 (Year 1)...',
     430                           self.browser.contents)
     431        self.browser.getControl("Create course list now").click()
     432        # Students can't open the customized pdf course registration slip
     433        self.browser.open(
     434            self.student_path + '/studycourse/100/course_registration_slip.pdf')
     435        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     436        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     437        path = os.path.join(samples_dir(), 'course_registration_slip.pdf')
     438        open(path, 'wb').write(self.browser.contents)
     439        print "Sample PDF course_registration_slip.pdf written to %s" % path
  • main/waeup.fceokene/trunk/src/waeup/fceokene/students/tests/test_utils.py

    r14586 r14591  
    3131        return
    3232
    33     def test_maxCreditsExceeded(self):
     33    def test_warnCreditsOOR(self):
    3434        students_utils = getUtility(IStudentsUtils)
    3535        studylevel = grok.Container()
    36         studylevel.total_credits = 40
     36        studylevel.total_credits_s1 = 17
     37        studylevel.total_credits_s2 = 17
    3738        course = grok.Model()
    38         course.credits = 18
     39        course.credits = 7
     40        course.semester = 1
    3941        warning = students_utils.warnCreditsOOR(studylevel, course)
    4042        self.assertEqual(warning, None)
    41         course.credits = 19
     43        course.credits = 8
    4244        warning = students_utils.warnCreditsOOR(studylevel, course)
    43         self.assertEqual(warning, 'Maximum credits exceeded.')
     45        self.assertEqual(warning, 'Maximum credits in 1st semester exceeded.')
     46        course.semester = 2
     47        warning = students_utils.warnCreditsOOR(studylevel, course)
     48        self.assertEqual(warning, 'Maximum credits in 2nd semester exceeded.')
     49        warning = students_utils.warnCreditsOOR(studylevel)
     50        self.assertEqual(warning, 'Minimum credits in 1st semester not reached.')
     51        studylevel.total_credits_s1 = 18
     52        warning = students_utils.warnCreditsOOR(studylevel)
     53        self.assertEqual(warning, 'Minimum credits in 2nd semester not reached.')
    4454        return
    4555
Note: See TracChangeset for help on using the changeset viewer.