Changeset 6548 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 23 Jul 2011, 14:26:46 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/tests/test_catalog.py
r6472 r6548 28 28 from zope.component import queryUtility 29 29 from zope.component.hooks import setSite, clearSite 30 from zope.interface.verify import verifyClass, verifyObject 30 31 from waeup.sirp.app import University 32 from waeup.sirp.interfaces import IQueryResultItem 31 33 from waeup.sirp.testing import FunctionalLayer 32 34 from waeup.sirp.accesscodes.accesscodes import ( 33 35 AccessCode, AccessCodeBatch, invalidate_accesscode, disable_accesscode) 34 36 from waeup.sirp.accesscodes.workflow import INITIALIZED, USED, DISABLED 37 from waeup.sirp.accesscodes.catalog import AccessCodeQueryResultItem 35 38 36 37 class AccessCodeCatalogTests(FunctionalTestCase): 38 # Tests for helpers like get_access_code, disable_accesscode, ...39 39 class CatalogTestSetup(FunctionalTestCase): 40 # A setup for testing accesscode catalog related stuff. 41 # 42 # sets up a site with some accesscode batches already created. 40 43 layer = FunctionalLayer 41 44 42 45 def setUp(self): 43 super( AccessCodeCatalogTests, self).setUp()46 super(CatalogTestSetup, self).setUp() 44 47 45 48 # Prepopulate ZODB … … 70 73 def tearDown(self): 71 74 shutil.rmtree(self.dc_root) 72 super( AccessCodeCatalogTests, self).tearDown()75 super(CatalogTestSetup, self).tearDown() 73 76 return 77 78 79 class AccessCodeCatalogTests(CatalogTestSetup): 80 # Tests for helpers like get_access_code, disable_accesscode, ... 81 82 layer = FunctionalLayer 74 83 75 84 def test_get_catalog(self): … … 160 169 result = cat.searchResults(state=(USED, USED)) 161 170 assert len(result) == 1 171 172 class FakeView(object): 173 # A view we can use in tests. Provides only the neccessary methods. 174 def url(self, context): 175 pass 176 177 class AccessCodeQueryResultItemTests(CatalogTestSetup): 178 # Test query result items 179 180 layer = FunctionalLayer 181 182 def test_ifaces(self): 183 # Make sure we implement the interfaces correctly 184 view = FakeView() 185 self.assertTrue(verifyClass( 186 IQueryResultItem, AccessCodeQueryResultItem)) 187 item = AccessCodeQueryResultItem(self.ac1, view) 188 self.assertTrue(verifyObject( 189 IQueryResultItem, item)) 190 return 191
Note: See TracChangeset for help on using the changeset viewer.