Search in sources :

Example 1 with ActionResult

use of teammates.ui.controller.ActionResult in project teammates by TEAMMATES.

the class BaseActionTest method verifyCannotAccess.

/**
 * Verifies that the {@link Action} matching the {@code params} is not
 * accessible to the logged in user.
 * This could be one of the following ways:
 * -> Unauthorised Access Exception
 * ->
 */
protected void verifyCannotAccess(String... params) {
    try {
        Action c = gaeSimulation.getActionObject(getActionUri(), params);
        ActionResult result = c.executeAndPostProcess();
        String classNameOfResult = result.getClass().getName();
        assertEquals(classNameOfResult, result.getClass().getName());
        AssertHelper.assertContains("You are not registered in the course ", result.getStatusMessage());
    } catch (UnauthorizedAccessException e) {
        ignoreExpectedException();
    }
}
Also used : Action(teammates.ui.controller.Action) ActionResult(teammates.ui.controller.ActionResult) UnauthorizedAccessException(teammates.common.exception.UnauthorizedAccessException)

Example 2 with ActionResult

use of teammates.ui.controller.ActionResult in project teammates by TEAMMATES.

the class ActionResultTest method testAppendParameters.

@Test
public void testAppendParameters() {
    ActionResult svr = new ShowPageResult("/page/instructorHome", null, null, null);
    assertEquals("/page/instructorHome", svr.getDestinationWithParams());
    svr.addResponseParam(Const.ParamsNames.USER_ID, "david");
    assertEquals("/page/instructorHome?user=david", svr.getDestinationWithParams());
}
Also used : ShowPageResult(teammates.ui.controller.ShowPageResult) ActionResult(teammates.ui.controller.ActionResult) Test(org.testng.annotations.Test)

Aggregations

ActionResult (teammates.ui.controller.ActionResult)2 Test (org.testng.annotations.Test)1 UnauthorizedAccessException (teammates.common.exception.UnauthorizedAccessException)1 Action (teammates.ui.controller.Action)1 ShowPageResult (teammates.ui.controller.ShowPageResult)1