Index: /main/waeup.sirp/trunk/src/waeup/sirp/utils/tests/test_helpers.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/utils/tests/test_helpers.py	(revision 6372)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/utils/tests/test_helpers.py	(revision 6373)
@@ -27,4 +27,6 @@
 import unittest
 import doctest
+from zope.security.testing import Principal, Participation
+from zope.security.management import newInteraction, endInteraction
 from waeup.sirp.utils import helpers
 
@@ -141,5 +143,5 @@
         self.expected += u'test with \xfcmlaut</p>\n</div>'
         return
-    
+
     def test_ascii_umlauts(self):
         # Make sure we convert umlauts correctly to unicode.
@@ -162,5 +164,5 @@
         self.assertTrue(isinstance(helpers.ReST2HTML(source), unicode))
 
-        
+
 class FactoryBaseTestCase(unittest.TestCase):
 
@@ -172,5 +174,28 @@
         self.assertTrue(factory.getInterfaces()(IFakeObject))
         return
-        
+
+class CurrentPrincipalTestCase(unittest.TestCase):
+
+    def tearDown(test):
+        endInteraction() # Just in case, one is still lingering around
+
+    def test_existing_principal(self):
+        # We can get the current principal if one is involved
+        principal = Principal('myprincipal')
+        newInteraction(Participation(principal))
+        result = helpers.get_current_principal()
+        self.assertTrue(result is principal)
+
+    def test_no_participation(self):
+        # Interactions without participation are handled correctly
+        newInteraction()
+        result = helpers.get_current_principal()
+        self.assertTrue(result is None)
+
+    def test_not_existing_principal(self):
+        # Missing interactions do not raise errors.
+        result = helpers.get_current_principal()
+        self.assertTrue(result is None)
+
 def test_suite():
     suite = unittest.TestSuite()
@@ -181,4 +206,5 @@
         CopyFileSystemTreeTestCase,
         RemoveFileOrDirectoryTestCase,
+        CurrentPrincipalTestCase,
         ]:
         suite.addTests(
