Changeset 9793 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 10 Dec 2012, 01:12:21 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/tests/test_async.py
r9217 r9793 14 14 from zope.container.interfaces import IContainer 15 15 from zope.interface import verify 16 from zope.site.folder import rootFolder 17 from zope.site.testing import createSiteManager 16 18 from waeup.kofa.interfaces import ( 17 19 WAEUP_KEY, IProgressable, IJobManager, IJobContainer … … 113 115 manager = getUtility(IJobManager) 114 116 self.assertTrue(isinstance(manager, JobManager)) 117 return 118 119 def test_get_site_no_site(self): 120 # if no site is around, we get a lookup error 121 manager = getUtility(IJobManager) 122 self.assertRaises(LookupError, manager._get_site, None) 123 return 124 125 def test_get_site_invalid_site(self): 126 # if we pass an invalid site, we get a lookup error 127 manager = getUtility(IJobManager) 128 self.assertRaises(LookupError, manager._get_site, object()) 129 return 130 131 def test_get_site_valid_site(self): 132 # if we pass a valid site, that will be respected 133 manager = getUtility(IJobManager) 134 result = manager._get_site(self.root_folder) 135 self.assertEqual(result, self.root_folder) 136 return 137 138 def test_get_site_externally_set_site(self): 139 # if, however, a site was set externally, it will be found 140 # even if passed in site is not valid 141 manager = getUtility(IJobManager) 142 site = rootFolder() 143 self.root_folder['application'] = site 144 createSiteManager(site, setsite=True) 145 transaction.commit() 146 result1 = manager._get_site(None) # no site given 147 result2 = manager._get_site(site) # valid site given 148 result3 = manager._get_site(object()) # invalid site given 149 result4 = manager._get_site(self.root_folder) # valid persisted obj 150 # we always get the externally set site... 151 self.assertEqual(result1, site) 152 self.assertEqual(result2, site) 153 self.assertEqual(result3, site) 154 # except if the passed object is already a valid persisted one 155 self.assertEqual(result4, self.root_folder) 115 156 return 116 157
Note: See TracChangeset for help on using the changeset viewer.