Search in sources :

Example 6 with Action

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

the class BaseActionTest method verifyCannotMasquerade.

/**
 * Verifies that the {@link Action} matching the {@code params} is not
 * accessible to the logged in user masquerading as another user.
 */
protected void verifyCannotMasquerade(String... params) {
    try {
        Action c = gaeSimulation.getActionObject(getActionUri(), params);
        c.executeAndPostProcess();
        signalFailureToDetectException();
    } catch (UnauthorizedAccessException e) {
        ignoreExpectedException();
    }
}
Also used : Action(teammates.ui.controller.Action) UnauthorizedAccessException(teammates.common.exception.UnauthorizedAccessException)

Example 7 with Action

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

the class BaseActionTest method verifyCanMasquerade.

/**
 * Verifies that the {@link Action} matching the {@code params} is
 * accessible to the logged in user masquerading as another user.
 */
protected void verifyCanMasquerade(String... params) {
    Action c = gaeSimulation.getActionObject(getActionUri(), params);
    assertTrue(c.isValidUser());
    c.executeAndPostProcess();
}
Also used : Action(teammates.ui.controller.Action)

Example 8 with Action

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

the class BaseActionTest method verifyAssumptionFailure.

/**
 * Verifies that the {@code parameters} violates an assumption of the
 * matching {@link Action}. e.g., missing a compulsory parameter.
 */
protected void verifyAssumptionFailure(String... parameters) {
    try {
        Action c = gaeSimulation.getActionObject(getActionUri(), parameters);
        c.executeAndPostProcess();
        signalFailureToDetectException();
    } catch (AssertionError | InvalidPostParametersException e) {
        ignoreExpectedException();
    }
}
Also used : Action(teammates.ui.controller.Action) InvalidPostParametersException(teammates.common.exception.InvalidPostParametersException)

Aggregations

Action (teammates.ui.controller.Action)8 UnauthorizedAccessException (teammates.common.exception.UnauthorizedAccessException)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 InvalidPostParametersException (teammates.common.exception.InvalidPostParametersException)1 AutomatedAction (teammates.ui.automated.AutomatedAction)1 AutomatedActionFactory (teammates.ui.automated.AutomatedActionFactory)1 ActionFactory (teammates.ui.controller.ActionFactory)1 ActionResult (teammates.ui.controller.ActionResult)1 RedirectResult (teammates.ui.controller.RedirectResult)1