Changeset 5808 for main


Ignore:
Timestamp:
7 Mar 2011, 13:07:53 (14 years ago)
Author:
uli
Message:

Move util tests from jambtables into applicants package (as they contain no JAMB specific functionality).

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

Legend:

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

    r5766 r5808  
    2626import unittest
    2727from StringIO import StringIO
     28from zope.component.hooks import setSite, clearSite
    2829from zope.interface.verify import verifyClass, verifyObject
    29 from waeup.sirp.applicants import interfaces
     30from zope.site import LocalSiteManager
     31from waeup.sirp.app import University
     32from waeup.sirp.applicants import (
     33    interfaces, application_exists, get_applicant_data, Applicant,
     34    ApplicantsContainer,
     35    )
    3036from waeup.sirp.applicants.root import (
    3137    ApplicantsRoot, ApplicantsPlugin,
    3238    )
     39from waeup.sirp.testing import WAeUPSIRPUnitTestLayer
     40
    3341
    3442class FakeSite(dict):
     
    148156        return
    149157
     158fake_apps = {
     159    'pude10' : ApplicantsContainer(),
     160    'pude11' : ApplicantsContainer(),
     161    }
     162
     163fake_apps['pude10']['APP-99999'] = Applicant()
     164
     165class HelperToolsTest(unittest.TestCase):
     166
     167    layer = WAeUPSIRPUnitTestLayer
     168   
     169    def setUp(self):
     170        self.app = University()
     171        # Insert some applicants...
     172        for container, data in fake_apps.items():
     173            self.app['applicants'][container] = data
     174        self.app.setSiteManager(LocalSiteManager(self.app))
     175        setSite(self.app)
     176        return
     177
     178    def tearDown(self):
     179        clearSite()
     180        return
     181
     182    def test_application_exists(self):
     183        result = application_exists('APP-99999')
     184        assert result is False
     185
     186        result = application_exists('APP-44444')
     187        assert result is True
     188        return
     189
     190   
    150191def suite():
    151192    suite = unittest.TestSuite()
     
    153194            ApplicantsRootTestCase,
    154195            ApplicantsRootPluginTestCase,
     196            HelperToolsTest,
    155197            ]:
    156198        suite.addTests(unittest.TestLoader().loadTestsFromTestCase(testcase))
Note: See TracChangeset for help on using the changeset viewer.