Changeset 6373 for main/waeup.sirp/trunk/src/waeup/sirp/utils
- Timestamp:
- 15 Jun 2011, 23:20:30 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/utils/tests/test_helpers.py
r5875 r6373 27 27 import unittest 28 28 import doctest 29 from zope.security.testing import Principal, Participation 30 from zope.security.management import newInteraction, endInteraction 29 31 from waeup.sirp.utils import helpers 30 32 … … 141 143 self.expected += u'test with \xfcmlaut</p>\n</div>' 142 144 return 143 145 144 146 def test_ascii_umlauts(self): 145 147 # Make sure we convert umlauts correctly to unicode. … … 162 164 self.assertTrue(isinstance(helpers.ReST2HTML(source), unicode)) 163 165 164 166 165 167 class FactoryBaseTestCase(unittest.TestCase): 166 168 … … 172 174 self.assertTrue(factory.getInterfaces()(IFakeObject)) 173 175 return 174 176 177 class CurrentPrincipalTestCase(unittest.TestCase): 178 179 def tearDown(test): 180 endInteraction() # Just in case, one is still lingering around 181 182 def test_existing_principal(self): 183 # We can get the current principal if one is involved 184 principal = Principal('myprincipal') 185 newInteraction(Participation(principal)) 186 result = helpers.get_current_principal() 187 self.assertTrue(result is principal) 188 189 def test_no_participation(self): 190 # Interactions without participation are handled correctly 191 newInteraction() 192 result = helpers.get_current_principal() 193 self.assertTrue(result is None) 194 195 def test_not_existing_principal(self): 196 # Missing interactions do not raise errors. 197 result = helpers.get_current_principal() 198 self.assertTrue(result is None) 199 175 200 def test_suite(): 176 201 suite = unittest.TestSuite() … … 181 206 CopyFileSystemTreeTestCase, 182 207 RemoveFileOrDirectoryTestCase, 208 CurrentPrincipalTestCase, 183 209 ]: 184 210 suite.addTests(
Note: See TracChangeset for help on using the changeset viewer.