01: package com.openedit.modules;
02:
03: import com.openedit.BaseTestCase;
04: import com.openedit.OpenEditException;
05: import com.openedit.WebPageRequest;
06: import com.openedit.modules.scheduler.TestModule;
07:
08: public class SecuredModuleTest extends BaseTestCase {
09: public void testSecuredAction() throws Exception {
10: TestModule securedMod = (TestModule) getFixture()
11: .getModuleManager().getModule("SecuredTestModule");
12: assertEquals(0, securedMod.getCount());
13: assertEquals(0, securedMod.getRestrictedCount());
14: WebPageRequest context = getFixture().createPageRequest(
15: "/actions/secured.html");
16: OpenEditException error = null;
17: try {
18: getFixture().getEngine().executePageActions(context);
19: } catch (OpenEditException e) {
20: error = e;
21: }
22: assertNotNull(error);
23: assertTrue(error.toString().contains(
24: "User does not have permission"));
25: assertTrue(securedMod.getCount() > 0);
26: assertEquals(0, securedMod.getRestrictedCount());
27: }
28: }
|