Changeset 6297
- Timestamp:
- 8 Jun 2011, 00:14:45 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_applicants.py
r6288 r6297 22 22 """Tests for applicants and related. 23 23 """ 24 import logging25 24 import unittest 26 from StringIO import StringIO 27 from hurry.file.file import IdFileRetrieval 28 from hurry.file.interfaces import IFileRetrieval 29 from zope.app.testing import placelesssetup 25 from zope.app.testing.functional import FunctionalTestCase 30 26 from zope.component import ( 31 27 provideAdapter, adapts, getGlobalSiteManager, provideUtility) … … 35 31 from zope.publisher.base import TestRequest 36 32 from zope.publisher.interfaces import NotFound 37 from waeup.sirp.interfaces import IWAeUPSIRPPluggable38 33 from waeup.sirp.image.image import WAeUPImageFile 39 34 from waeup.sirp.image.interfaces import IWAeUPImageFile … … 44 39 IResultEntry, IApplicant, 45 40 ) 41 from waeup.sirp.testing import FunctionalLayer 46 42 47 43 class FakeImageLocation(object): … … 69 65 assert entry.score == 3.7 70 66 71 class ApplicantTest(unittest.TestCase): 67 class ApplicantTest(FunctionalTestCase): 68 69 layer = FunctionalLayer 72 70 73 71 def setUp(self): 74 placelesssetup.setUp()75 provideUtility(IdFileRetrieval(), IFileRetrieval)76 72 self.applicant = Applicant() 77 73 78 74 def tearDown(self): 79 placelesssetup.tearDown()80 75 pass 81 76 … … 84 79 verify.verifyObject(IApplicant, self.applicant) 85 80 86 class ApplicantFactoryTest(unittest.TestCase): 81 class ApplicantFactoryTest(FunctionalTestCase): 82 83 layer = FunctionalLayer 87 84 88 85 def setUp(self): … … 104 101 assert implemented_by.isOrExtends(IApplicant) 105 102 106 class ApplicantTraverserTest(unittest.TestCase): 103 104 class ApplicantTraverserTest(FunctionalTestCase): 105 106 layer = FunctionalLayer 107 107 108 108 def setUp(self): 109 super(ApplicantTraverserTest, self).setUp() 110 provideAdapter(FakeImageLocation) 109 111 self.applicant = Applicant() 112 110 113 self.request = TestRequest('') 111 self.gsm = getGlobalSiteManager()112 self.gsm.registerAdapter(FakeImageLocation)113 self.fileretrieval = IdFileRetrieval()114 provideUtility(self.fileretrieval, IFileRetrieval)115 114 return 116 115 117 116 def tearDown(self): 118 self.gsm.unregisterAdapter(FakeImageLocation) 119 self.gsm.unregisterUtility(self.fileretrieval, IFileRetrieval) 117 gsm = getGlobalSiteManager() 118 gsm.unregisterAdapter(FakeImageLocation) 119 super(ApplicantTraverserTest, self).tearDown() 120 120 return 121 121 … … 162 162 self.assertTrue(isinstance(result, FakeImageLocation)) 163 163 return 164 165 def test_suite():166 suite = unittest.TestSuite()167 for testcase in [168 ResultEntryTest, ApplicantTest, ApplicantFactoryTest,169 ApplicantTraverserTest,170 ]:171 suite.addTest(unittest.TestLoader().loadTestsFromTestCase(172 testcase173 )174 )175 return suite
Note: See TracChangeset for help on using the changeset viewer.