Ignore:
Timestamp:
31 Aug 2012, 20:19:08 (12 years ago)
Author:
Henrik Bettermann
Message:

Return error code after transfer.

Add history message.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_student.py

    r9136 r9137  
    267267        self.assertRaises(
    268268            RequiredMissing, self.student.transfer, self.certificate2)
    269         success = self.student.transfer(self.certificate2,
    270             current_session=2013)
     269        error = self.student.transfer(self.certificate2, current_session=1000)
     270        self.assertTrue(error == -1)
     271        error = self.student.transfer(self.certificate2, current_session=2013)
     272        self.assertTrue(error == None)
    271273        self.assertEqual(self.student['studycourse_1'].certificate.code, 'CERT1')
    272274        self.assertEqual(self.student['studycourse'].certificate.code, 'CERT2')
     
    281283        self.assertTrue('system - K1000000 - transferred from CERT1 to CERT2'
    282284            in logcontent)
     285        messages = ' '.join(self.student.history.messages)
     286        self.assertMatches(
     287            '...<YYYY-MM-DD hh:mm:ss> UTC - '
     288            'Transferred from CERT1 to CERT2 by system', messages)
    283289
    284290        # The students_catalog has been updated.
     
    297303
    298304        # Students can be transferred (only) two times.
    299         success = self.student.transfer(self.certificate,
     305        error = self.student.transfer(self.certificate,
    300306            current_session=2013)
    301         self.assertTrue(success)
    302         success = self.student.transfer(self.certificate2,
     307        self.assertTrue(error == None)
     308        error = self.student.transfer(self.certificate2,
    303309            current_session=2013)
    304         self.assertFalse(success)
     310        self.assertTrue(error == -2)
    305311        self.assertEqual([i for i in self.student.keys()],
    306312            [u'accommodation', u'payments', u'studycourse',
Note: See TracChangeset for help on using the changeset viewer.