Changeset 15429


Ignore:
Timestamp:
27 May 2019, 10:51:04 (5 years ago)
Author:
Henrik Bettermann
Message:

We check if there exists a certificate course in the certificate
container which refers to course ticket to be added. If such an object does
not exist, students and managers will be prevented from registering
the corresponding course.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/students/studylevel.py

    r15428 r15429  
    329329                  'book fee have been paid.'
    330330                  % course.code))
     331        # We check if there exists a certificate course in the certificate
     332        # container which refers to the course. If such an object does
     333        # not exist, students and managers will be prevented from registering
     334        # the corresponding course.
     335        cert = self.__parent__.certificate
     336        ticket_allowed = False
     337        for val in cert.values():
     338            if val.course == course:
     339                ticket_allowed = True
     340                break
     341        if not ticket_allowed:
     342            raise TicketError(
     343                _('%s is not part of the %s curriculum.'
     344                  % (course.code, cert.code)))
    331345        ticket.code = course.code
    332346        ticket.title = course.title
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r15428 r15429  
    13381338        self.student['studycourse']['200']['COURSE1'].outstanding = True
    13391339        self.browser.getControl("Add course ticket").click()
    1340         self.assertMatches(
    1341             '...Successfully added COURSE2...', self.browser.contents)
     1340        # Corresponding certificate course is missing
     1341        self.assertTrue(
     1342            'COURSE2 is not part of the CERT1 curriculum.'
     1343            in self.browser.contents)
     1344        self.app['faculties']['fac1']['dep1'].certificates[
     1345            'CERT1'].addCertCourse(self.course, level=100)
     1346        self.browser.getControl("Add course ticket").click()
     1347        self.assertTrue(
     1348            'Successfully added COURSE2' in self.browser.contents)
    13421349        return
    13431350
Note: See TracChangeset for help on using the changeset viewer.