Search in sources :

Example 1 with InstructorEditInstructorFeedbackPageAction

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

the class InstructorEditInstructorFeedbackPageActionTest method testExecuteAndPostProcess.

@Override
@Test
public void testExecuteAndPostProcess() {
    InstructorAttributes instructor = dataBundle.instructors.get("IEIFPTCourseinstr");
    InstructorAttributes moderatedInstructor = dataBundle.instructors.get("IEIFPTCoursehelper1");
    InstructorEditInstructorFeedbackPageAction editInstructorFpAction;
    ShowPageResult showPageResult;
    String courseId = moderatedInstructor.courseId;
    String feedbackSessionName = "";
    String moderatedInstructorEmail = "IEIFPTCoursehelper1@gmail.tmt";
    String[] submissionParams;
    gaeSimulation.loginAsInstructor(instructor.googleId);
    ______TS("typical success case");
    feedbackSessionName = "First feedback session";
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName, Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderatedInstructorEmail };
    editInstructorFpAction = getAction(submissionParams);
    showPageResult = getShowPageResult(editInstructorFpAction);
    assertEquals(getPageResultDestination(Const.ViewURIs.INSTRUCTOR_FEEDBACK_SUBMISSION_EDIT, false, instructor.googleId), showPageResult.getDestinationWithParams());
    assertEquals("", showPageResult.getStatusMessage());
    AssertHelper.assertLogMessageEquals("TEAMMATESLOG|||instructorEditInstructorFeedbackPage|||instructorEditInstructorFeedbackPage" + "|||true|||Instructor|||IEIFPTCourseinstr|||IEIFPTCourseinstr|||IEIFPTCourseintr@course1.tmt|||" + "Moderating feedback session for instructor (" + moderatedInstructor.email + ")<br>" + "Session Name: First feedback session<br>Course ID: IEIFPTCourse|||" + "/page/instructorEditInstructorFeedbackPage", editInstructorFpAction.getLogMessage());
    ______TS("success: another feedback");
    feedbackSessionName = "Another feedback session";
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName, Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderatedInstructorEmail };
    editInstructorFpAction = getAction(submissionParams);
    showPageResult = getShowPageResult(editInstructorFpAction);
    assertEquals(getPageResultDestination(Const.ViewURIs.INSTRUCTOR_FEEDBACK_SUBMISSION_EDIT, false, instructor.googleId), showPageResult.getDestinationWithParams());
    assertEquals("", showPageResult.getStatusMessage());
    String logMessage = "TEAMMATESLOG|||instructorEditInstructorFeedbackPage|||" + "instructorEditInstructorFeedbackPage|||true|||Instructor|||IEIFPTCourseinstr|||" + "IEIFPTCourseinstr|||IEIFPTCourseintr@course1.tmt|||" + "Moderating feedback session for instructor (" + moderatedInstructor.email + ")<br>" + "Session Name: Another feedback session<br>Course ID: IEIFPTCourse|||" + "/page/instructorEditInstructorFeedbackPage";
    AssertHelper.assertLogMessageEquals(logMessage, editInstructorFpAction.getLogMessage());
    ______TS("failure: accessing non-existent moderatedinstructor email");
    gaeSimulation.loginAsInstructor(instructor.googleId);
    moderatedInstructorEmail = "non-exIstentEmail@gsail.tmt";
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName, Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderatedInstructorEmail };
    try {
        editInstructorFpAction = getAction(submissionParams);
        editInstructorFpAction.executeAndPostProcess();
        signalFailureToDetectException();
    } catch (EntityNotFoundException enfe) {
        assertEquals("Instructor Email " + moderatedInstructorEmail + " does not exist in " + courseId + ".", enfe.getMessage());
    }
}
Also used : ShowPageResult(teammates.ui.controller.ShowPageResult) InstructorEditInstructorFeedbackPageAction(teammates.ui.controller.InstructorEditInstructorFeedbackPageAction) EntityNotFoundException(teammates.common.exception.EntityNotFoundException) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)1 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)1 EntityNotFoundException (teammates.common.exception.EntityNotFoundException)1 InstructorEditInstructorFeedbackPageAction (teammates.ui.controller.InstructorEditInstructorFeedbackPageAction)1 ShowPageResult (teammates.ui.controller.ShowPageResult)1