Changeset 9794 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 10 Dec 2012, 01:22:50 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/tests/test_async.py
r9793 r9794 104 104 self.root = self.root_folder._p_jar.root() 105 105 106 def set_site(self): 107 # helper to set a site 'externally'. 108 # This is a bit complicated under the given limited setup conditions. 109 # Returns a persisted site. 110 site = rootFolder() 111 self.root_folder['application'] = site 112 createSiteManager(site, setsite=True) 113 transaction.commit() 114 return site 115 106 116 def test_iface_job_manager(self): 107 117 # JobManager implements the promised interfaces … … 136 146 return 137 147 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) 148 def test_get_site_ext_set_none_given(self): 149 # with an externally set site we don't have to pass in a site 150 manager = getUtility(IJobManager) 151 site = self.set_site() 152 result = manager._get_site(None) 153 self.assertEqual(result, site) 154 return 155 156 def test_get_site_ext_set_valid_site(self): 157 # with an externally set site we can pass in this site 158 manager = getUtility(IJobManager) 159 site = self.set_site() 160 result = manager._get_site(site) 161 self.assertEqual(result, site) 162 return 163 164 def test_get_site_ext_set_invalid_site(self): 165 # with an externally set site we can pass in invalid sites 166 manager = getUtility(IJobManager) 167 site = self.set_site() 168 result = manager._get_site(object()) 169 self.assertEqual(result, site) 170 return 171 172 def test_get_site_ext_set_valid_obj(self): 173 # valid persisted objects override externally set sites 174 manager = getUtility(IJobManager) 175 site = self.set_site() 176 result = manager._get_site(self.root_folder) 177 self.assertEqual(result, self.root_folder) 156 178 return 157 179
Note: See TracChangeset for help on using the changeset viewer.