Ignore:
Timestamp:
7 Mar 2011, 02:14:02 (14 years ago)
Author:
uli
Message:

Add tests for new function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/jambtables/tests/test_jambtables.py

    r5797 r5800  
    3838from zope.site import LocalSiteManager
    3939from zope.site.hooks import setSite, clearSite
     40from zope.site.testing import createSiteManager
    4041
    4142from waeup.sirp.app import University
    4243from waeup.sirp.datacenter import DataCenter
     44from waeup.sirp.testing import WAeUPSIRPUnitTestLayer
    4345from waeup.sirp.applicants.jambtables import (
    44     JAMBDataPlugin, JAMBDataRoot,
     46    JAMBDataPlugin, JAMBDataRoot, get_jambdata,
    4547    )
    4648from waeup.sirp.applicants.jambtables.interfaces import (
    4749    IJAMBDataRoot,
    4850    )
     51from waeup.sirp.applicants import Applicant
     52from waeup.sirp.applicants.container import ApplicantsContainer
     53
    4954
    5055class FakeSite(dict):
     
    175180        return
    176181
    177        
     182class GetJAMBDataTestCase(unittest.TestCase):
     183
     184    layer = WAeUPSIRPUnitTestLayer
     185   
     186    def setUp(self):
     187        self.app = University()
     188        # Fill up some JAMB data...
     189        self.appl1 = Applicant()
     190        self.appl2 = Applicant()
     191        self.app['jambdata']['91100546DD'] = self.appl1
     192        self.app['jambdata']['91100546DE'] = self.appl2
     193        createSiteManager(self.app, setsite=True)
     194        return
     195
     196    def tearDown(self):
     197        pass
     198
     199    def test_contained(self):
     200        self.assertEqual(get_jambdata('91100546DD'), self.appl1)
     201        return
     202
     203    def test_not_contained(self):
     204        self.assertEqual(get_jambdata('not-existing'), None)
     205        return
     206
    178207def test_suite():
    179208    suite = unittest.TestSuite()
    180209    for testcase in [
    181         JAMBDataRootTestCase, JAMBDataPluginTestCase,
     210        JAMBDataRootTestCase, JAMBDataPluginTestCase, GetJAMBDataTestCase,
    182211        ]:
    183212        suite.addTest(unittest.TestLoader().loadTestsFromTestCase(
Note: See TracChangeset for help on using the changeset viewer.