Code

more doc, more cleanup
[roundup.git] / test / test_security.py
index dce68fdb0d8ea0459f2cbc7ae44baa8471095eab..f55656f76cafb3c6e63e65f9859ca3954811f6ca 100644 (file)
@@ -18,7 +18,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-# $Id: test_security.py,v 1.2 2002-07-26 08:27:00 richard Exp $
+# $Id: test_security.py,v 1.3 2002-07-29 21:53:29 richard Exp $
 
 import os, unittest, shutil
 
@@ -71,7 +71,9 @@ class PermissionTest(MyTestCase):
 
     def testAccessControls(self):
         self.testDBinit()
-        self.testInitialiseSecurity()
+        ei = self.db.security.addPermission(name="Edit", klass="issue",
+                        description="User is allowed to edit issues")
+        self.db.security.addPermissionToRole('User', ei)
 
         # test class-level access
         userid = self.db.user.lookup('admin')
@@ -84,6 +86,8 @@ class PermissionTest(MyTestCase):
             'issue'), 1)
         self.assertEquals(self.db.security.hasPermission('Edit', userid,
             'user'), 0)
+        self.assertEquals(self.db.security.hasPermission('View', userid,
+            'issue'), 0)
 
         # test node-level access
         issueid = self.db.issue.create(title='foo', assignedto='admin')
@@ -102,6 +106,11 @@ def suite():
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.2  2002/07/26 08:27:00  richard
+# Very close now. The cgi and mailgw now use the new security API. The two
+# templates have been migrated to that setup. Lots of unit tests. Still some
+# issue in the web form for editing Roles assigned to users.
+#
 # Revision 1.1  2002/07/25 07:14:06  richard
 # Bugger it. Here's the current shape of the new security implementation.
 # Still to do: