use of teammates.ui.controller.RedirectResult in project teammates by TEAMMATES.
the class StudentProfilePictureEditActionTest method testActionForEmptyLeftX.
private void testActionForEmptyLeftX(AccountAttributes student) {
______TS("Failure case: empty parameter - leftx");
String expectedUrl = getPageResultDestination(Const.ActionURIs.STUDENT_PROFILE_PAGE, true, student.googleId);
String[] submissionParams = createValidParamsForProfilePictureEdit();
submissionParams[1] = "";
StudentProfilePictureEditAction action = getAction(submissionParams);
RedirectResult result = getRedirectResult(action);
String expectedLogMessage = getExpectedLogMessageEmptyCoords(student);
AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
assertEquals(expectedUrl, result.getDestinationWithParams());
}
use of teammates.ui.controller.RedirectResult in project teammates by TEAMMATES.
the class StudentProfilePictureEditActionTest method testActionForZeroHeight.
private void testActionForZeroHeight(AccountAttributes student) {
______TS("Failure case: zero height");
String expectedLogMessage = getExpectedLogMessageZeroDimensions(student);
String expectedUrl = getPageResultDestination(Const.ActionURIs.STUDENT_PROFILE_PAGE, true, student.googleId);
String[] submissionParams = createValidParamsForProfilePictureEdit();
submissionParams[9] = "0";
StudentProfilePictureEditAction action = getAction(submissionParams);
RedirectResult result = getRedirectResult(action);
AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
assertEquals(expectedUrl, result.getDestinationWithParams());
}
use of teammates.ui.controller.RedirectResult in project teammates by TEAMMATES.
the class StudentProfilePictureEditActionTest method testActionForEmptyRightY.
private void testActionForEmptyRightY(AccountAttributes student) {
String[] submissionParams;
______TS("Failure case: empty parameter - rightx");
String expectedLogMessage = getExpectedLogMessageEmptyCoords(student);
String expectedUrl = getPageResultDestination(Const.ActionURIs.STUDENT_PROFILE_PAGE, true, student.googleId);
submissionParams = createValidParamsForProfilePictureEdit();
submissionParams[3] = "";
StudentProfilePictureEditAction action = getAction(submissionParams);
RedirectResult result = getRedirectResult(action);
AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
assertEquals(expectedUrl, result.getDestinationWithParams());
}
use of teammates.ui.controller.RedirectResult in project teammates by TEAMMATES.
the class InstructorEditInstructorFeedbackSaveActionTest method testModifyResponses.
private void testModifyResponses() {
FeedbackQuestionsDb fqDb = new FeedbackQuestionsDb();
FeedbackQuestionAttributes fq = fqDb.getFeedbackQuestion("First feedback session", "IEIFPTCourse", 1);
assertNotNull("Feedback question not found in database", fq);
FeedbackResponsesDb frDb = new FeedbackResponsesDb();
FeedbackResponseAttributes fr = dataBundle.feedbackResponses.get("response1ForQ1");
fr = frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
assertNotNull("Feedback response not found in database", fr);
InstructorAttributes instructor = dataBundle.instructors.get("IEIFPTCourseinstr");
InstructorEditInstructorFeedbackSaveAction editInstructorFsAction;
RedirectResult redirectResult;
String moderatedInstructorEmail = "IEIFPTCoursehelper1@gmail.tmt";
String[] submissionParams;
gaeSimulation.loginAsInstructor(instructor.googleId);
______TS("edit existing answer");
submissionParams = new String[] { Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1", Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName, Const.ParamsNames.COURSE_ID, fr.courseId, Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId, Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient, Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(), Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "Edited" + fr.getResponseDetails().getAnswerString(), Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderatedInstructorEmail };
editInstructorFsAction = getAction(submissionParams);
redirectResult = getRedirectResult(editInstructorFsAction);
assertFalse(redirectResult.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, redirectResult.getStatusMessage());
assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_EDIT_INSTRUCTOR_FEEDBACK_PAGE, false, "IEIFPTCoursehelper1%40gmail.tmt", "IEIFPTCourseinstr", "IEIFPTCourse", "First+feedback+session"), redirectResult.getDestinationWithParams());
assertNotNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
// submission confirmation email not sent if parameter does not exist
verifyNoEmailsSent(editInstructorFsAction);
______TS("deleted response");
submissionParams = new String[] { Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1", Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName, Const.ParamsNames.COURSE_ID, fr.courseId, Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId, Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient, Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(), Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "", Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderatedInstructorEmail, Const.ParamsNames.SEND_SUBMISSION_EMAIL, "on" };
editInstructorFsAction = getAction(submissionParams);
redirectResult = getRedirectResult(editInstructorFsAction);
assertFalse(redirectResult.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, redirectResult.getStatusMessage());
assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_EDIT_INSTRUCTOR_FEEDBACK_PAGE, false, "IEIFPTCoursehelper1%40gmail.tmt", "IEIFPTCourseinstr", "IEIFPTCourse", "First+feedback+session"), redirectResult.getDestinationWithParams());
assertNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
// submission confirmation email still not sent even if parameter is "on" because this is moderation
verifyNoEmailsSent(editInstructorFsAction);
// delete respondent task scheduled
verifySpecifiedTasksAdded(editInstructorFsAction, Const.TaskQueue.FEEDBACK_SESSION_UPDATE_RESPONDENT_QUEUE_NAME, 1);
______TS("skipped question");
submissionParams = new String[] { Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1", Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName, Const.ParamsNames.COURSE_ID, fr.courseId, Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId, Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient, Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(), Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "", Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderatedInstructorEmail };
editInstructorFsAction = getAction(submissionParams);
redirectResult = getRedirectResult(editInstructorFsAction);
assertFalse(redirectResult.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, redirectResult.getStatusMessage());
assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_EDIT_INSTRUCTOR_FEEDBACK_PAGE, false, "IEIFPTCoursehelper1%40gmail.tmt", "IEIFPTCourseinstr", "IEIFPTCourse", "First+feedback+session"), redirectResult.getDestinationWithParams());
assertNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
______TS("new response");
submissionParams = new String[] { Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1", Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName, Const.ParamsNames.COURSE_ID, fr.courseId, Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId, Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient, Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(), Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "New " + fr.getResponseDetails().getAnswerString(), Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderatedInstructorEmail };
editInstructorFsAction = getAction(submissionParams);
redirectResult = getRedirectResult(editInstructorFsAction);
assertFalse(redirectResult.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, redirectResult.getStatusMessage());
assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_EDIT_INSTRUCTOR_FEEDBACK_PAGE, false, "IEIFPTCoursehelper1%40gmail.tmt", "IEIFPTCourseinstr", "IEIFPTCourse", "First+feedback+session"), redirectResult.getDestinationWithParams());
assertNotNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
// append respondent task scheduled
verifySpecifiedTasksAdded(editInstructorFsAction, Const.TaskQueue.FEEDBACK_SESSION_UPDATE_RESPONDENT_QUEUE_NAME, 1);
}
use of teammates.ui.controller.RedirectResult in project teammates by TEAMMATES.
the class InstructorEditInstructorFeedbackSaveActionTest method testClosedSession.
private void testClosedSession() {
FeedbackQuestionsDb fqDb = new FeedbackQuestionsDb();
FeedbackQuestionAttributes fq = fqDb.getFeedbackQuestion("Closed feedback session", "IEIFPTCourse", 1);
assertNotNull("Feedback question not found in database", fq);
FeedbackResponsesDb frDb = new FeedbackResponsesDb();
FeedbackResponseAttributes fr = dataBundle.feedbackResponses.get("response1ForQ1InClosedSession");
fr = frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
assertNotNull("Feedback response not found in database", fr);
InstructorAttributes instructor = dataBundle.instructors.get("IEIFPTCourseinstr");
InstructorEditInstructorFeedbackSaveAction editInstructorFsAction;
RedirectResult redirectResult;
String moderatedInstructorEmail = "IEIFPTCourseintr@gmail.tmt";
String[] submissionParams;
gaeSimulation.loginAsInstructor(instructor.googleId);
______TS("Success case: modifying responses in closed session");
submissionParams = new String[] { Const.ParamsNames.FEEDBACK_QUESTION_RESPONSETOTAL + "-1", "1", Const.ParamsNames.FEEDBACK_RESPONSE_ID + "-1-0", fr.getId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fr.feedbackSessionName, Const.ParamsNames.COURSE_ID, fr.courseId, Const.ParamsNames.FEEDBACK_QUESTION_ID + "-1", fr.feedbackQuestionId, Const.ParamsNames.FEEDBACK_RESPONSE_RECIPIENT + "-1-0", fr.recipient, Const.ParamsNames.FEEDBACK_QUESTION_TYPE + "-1", fr.feedbackQuestionType.toString(), Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0", "Edited" + fr.getResponseDetails().getAnswerString(), Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderatedInstructorEmail };
editInstructorFsAction = getAction(submissionParams);
redirectResult = getRedirectResult(editInstructorFsAction);
assertFalse(redirectResult.isError);
assertEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED, redirectResult.getStatusMessage());
assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_EDIT_INSTRUCTOR_FEEDBACK_PAGE, false, "IEIFPTCourseintr%40gmail.tmt", "IEIFPTCourseinstr", "IEIFPTCourse", "Closed+feedback+session"), redirectResult.getDestinationWithParams());
assertNotNull(frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient));
}
Aggregations