1 4 package com.openedit.modules.admin; 5 6 import com.openedit.BaseTestCase; 7 import com.openedit.WebPageRequest; 8 import com.openedit.page.PageRequestKeys; 9 10 14 public class PermissionTest extends BaseTestCase 15 { 16 public PermissionTest(String inName) 17 { 18 super(inName); 19 } 20 21 public void testEditing() throws Exception 22 { 23 WebPageRequest req = getFixture().createPageRequest("/permissions/sub/index.html"); 24 getFixture().getEngine().executePageActions(req); 25 assertTrue( req.isEditable() ); 26 27 req.removePageValue(PageRequestKeys.USER); 28 getFixture().getEngine().executePageActions(req); 29 assertFalse( req.isEditable() ); 30 31 } 32 33 public void testView() throws Exception 34 { 35 WebPageRequest req = getFixture().createPageRequest("/permissions/noread/index.html"); 37 getFixture().getEngine().executePageActions(req); 38 assertFalse( req.hasRedirected() ); 39 40 req.removePageValue(PageRequestKeys.USER); 42 getFixture().getEngine().executePageActions(req); 43 assertTrue( req.hasRedirected() ); 44 45 } 46 47 48 } 49 | Popular Tags |