Update of /var/cvs/tests/cloudcontext/org/mmbase/security/cloudcontext
In directory james.mmbase.org:/tmp/cvs-serv18769/cloudcontext

Modified Files:
        CloudContext.java 
Log Message:
tests for delete and change context


See also: 
http://cvs.mmbase.org/viewcvs/tests/cloudcontext/org/mmbase/security/cloudcontext


Index: CloudContext.java
===================================================================
RCS file: 
/var/cvs/tests/cloudcontext/org/mmbase/security/cloudcontext/CloudContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- CloudContext.java   16 Dec 2008 16:59:34 -0000      1.3
+++ CloudContext.java   16 Dec 2008 17:09:24 -0000      1.4
@@ -26,8 +26,13 @@
 
 public class CloudContext extends BridgeTest {
 
+    static boolean started = false;
+
     public void setUp() throws Exception  {
+        if (! started) {
         startMMBase();
+            started = true;
+        }
     }
 
     public void testImplementation() {
@@ -51,6 +56,8 @@
         }
         Node n2 = cloud.getNodeManager("news").createNode();
         n2.commit();
+        Node n3 = cloud.getNodeManager("news").createNode();
+        n3.commit();
     }
 
     public void testWriteRights() {
@@ -64,10 +71,49 @@
         } catch (SecurityException se) {
             // ok
         }
+        
         news.setStringValue("title", "blaa");
         news.commit();
         
     }
 
+    public void testDeleteRights() {
+        Cloud cloud = getCloud("foo");
+        Node context = 
cloud.getNodeManager("mmbasecontexts").getList(null).get(0);
+        Node news = cloud.getNodeManager("news").getList(null).get(0);
+        assertFalse(context.mayDelete());
+        assertTrue(news.mayDelete());
+        try {
+            context.delete(true);
+        } catch (SecurityException se) {
+            // ok
+        }
+        
+        news.delete(true);
+        news.commit();
+        
+    }
+
+
+    public void testChangeContextRights() {
+        Cloud cloud = getCloud("foo");
+        Node context = 
cloud.getNodeManager("mmbasecontexts").getList(null).get(0);
+        Node news = cloud.getNodeManager("news").getList(null).get(0);
+        assertFalse(context.mayChangeContext());
+        assertTrue(news.mayChangeContext());
+        try {
+            context.setContext("default");
+        } catch (SecurityException se) {
+            // ok
+        }
+        
+        news.setContext("admin");
+        news.commit();
+        // changed to a context which we may not change again
+        assertFalse(news.mayChangeContext());                                  
             
+        
+    }
+
+
 }
 
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to