Ignore:
Timestamp:
22 Jun 2016, 13:19:20 (9 years ago)
Author:
Henrik Bettermann
Message:

Add refereereports property attribute.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/applicants
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py

    r13968 r13974  
    4242from waeup.kofa.applicants.workflow import application_states_dict
    4343from waeup.kofa.applicants.payment import ApplicantOnlinePayment
     44from waeup.kofa.applicants.refereereport import ApplicantRefereeReport
    4445
    4546def search(query=None, searchtype=None, view=None):
     
    7879            if isinstance(value, ApplicantOnlinePayment)]
    7980        return payments
     81
     82    @property
     83    def refereereports(self):
     84        reports = [value for value in self.values()
     85            if isinstance(value, ApplicantRefereeReport)]
     86        return reports
    8087
    8188    def writeLogMessage(self, view, message):
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_applicant.py

    r13968 r13974  
    3535from waeup.kofa.applicants.interfaces import IApplicant
    3636from waeup.kofa.applicants.payment import ApplicantOnlinePayment
     37from waeup.kofa.applicants.refereereport import ApplicantRefereeReport
    3738from waeup.kofa.testing import FunctionalTestCase, FunctionalLayer
    3839
     
    208209    def test_payments(self):
    209210        payment = ApplicantOnlinePayment()
    210         no_payment = object()
     211        no_payment = ApplicantRefereeReport()
    211212        self.applicant['pid'] = payment
    212213        self.applicant['nopid'] = no_payment
    213214        self.assertEqual(len(self.applicant.values()),2)
    214215        self.assertEqual(len(self.applicant.payments),1)
    215         self.assertEqual(self.applicant.payments[0],payment)
     216        self.assertEqual(self.applicant.payments[0], payment)
     217        return
     218
     219    def test_refereereports(self):
     220        report = ApplicantRefereeReport()
     221        no_report = ApplicantOnlinePayment()
     222        self.applicant['rid'] = report
     223        self.applicant['norid'] = no_report
     224        self.assertEqual(len(self.applicant.values()),2)
     225        self.assertEqual(len(self.applicant.refereereports),1)
     226        self.assertEqual(self.applicant.refereereports[0], report)
    216227        return
    217228
Note: See TracChangeset for help on using the changeset viewer.