Ignore:
Timestamp:
25 Jan 2011, 17:06:49 (14 years ago)
Author:
uli
Message:

Add REQUIRES_JAMBDATA attribute for applicant containers.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/applicants
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/container.py

    r5676 r5682  
    3131    grok.implements(IApplicantsContainer)
    3232
    33     id = None
     33    REQUIRES_JAMBDATA = False
     34    name = None
    3435    title = None
    3536    description = None
     
    6970        """
    7071        raise NotImplemented()
     72
     73class JAMBBasedApplicantsContainer(ApplicantsContainer):
     74    """An applicants container contains university applicants.
     75
     76    For applicants added to this container JAMB data must be available
     77    already.
     78    """
     79    REQUIRES_JAMBDATA = True
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py

    r5681 r5682  
    6262
    6363    """
    64     id = schema.TextLine(
     64    REQUIRES_JAMBDATA = schema.Bool(
     65        title = u'JAMB data required',
     66        description = u'This container requires JAMB data to be available.',
     67        required = True,
     68        default = False,
     69        )
     70       
     71    name = schema.TextLine(
    6572        title = u'Internal ID',
    6673        required = True,
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_container.py

    r5676 r5682  
    2626from zope.interface.verify import verifyClass, verifyObject
    2727from waeup.sirp.applicants import interfaces
    28 from waeup.sirp.applicants.container import ApplicantsContainer
     28from waeup.sirp.applicants.container import (
     29    ApplicantsContainer, JAMBBasedApplicantsContainer,
     30    )
    2931
    3032class ApplicantsContainerTestCase(unittest.TestCase):
     
    4244        return
    4345
     46class JAMBBasedApplicantsContainerTestCase(unittest.TestCase):
     47
     48    def test_interfaces(self):
     49        # Make sure the correct interfaces are implemented.
     50        self.assertTrue(
     51            verifyClass(
     52                interfaces.IApplicantsContainer, JAMBBasedApplicantsContainer)
     53            )
     54        self.assertTrue(
     55            verifyObject(
     56                interfaces.IApplicantsContainer, JAMBBasedApplicantsContainer())
     57            )
     58        return
     59
    4460def suite():
    4561    suite = unittest.TestSuite()
    46     suite.addTests(
    47         unittest.TestLoader().loadTestsFromTestCase(
    48             ApplicantsContainerTestCase,
    49             )
    50         )
     62    for test_case in [
     63        ApplicantsContainerTestCase,
     64        JAMBBasedApplicantsContainerTestCase,
     65        ]:
     66        suite.addTests(
     67            unittest.TestLoader().loadTestsFromTestCase(test_case))
    5168    return suite
    5269
Note: See TracChangeset for help on using the changeset viewer.