Search in sources :

Example 6 with InstructorFeedbackQuestionAddAction

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

the class InstructorFeedbackQuestionAddActionTest method testExecuteAndPostProcessConstSumRecipient.

@Test
public void testExecuteAndPostProcessConstSumRecipient() {
    InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
    gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
    ______TS("Typical case");
    FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
    String[] params = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, FeedbackParticipantType.STUDENTS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, FeedbackParticipantType.STUDENTS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, "1", Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "CONSTSUM", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "Split points among students.", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTS, "30", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSFOREACHOPTION, "50", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSFOREACHRECIPIENT, "100", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSPEROPTION, "true", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMTORECIPIENTS, "true", // default value.
    Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, // default value.
    "2", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "custom", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIES, "2", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.RECEIVER.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.RECEIVER.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.RECEIVER.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit" };
    InstructorFeedbackQuestionAddAction action = getAction(params);
    RedirectResult result = getRedirectResult(action);
    assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "First+feedback+session", instructor1ofCourse1.googleId, false), result.getDestinationWithParams());
    assertEquals(Const.StatusMessages.FEEDBACK_QUESTION_ADDED, result.getStatusMessage());
    String expectedLogMessage = "TEAMMATESLOG|||instructorFeedbackQuestionAdd|||" + "instructorFeedbackQuestionAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||" + "idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + "Created Feedback Question for Feedback Session:<span class=\"bold\">" + "(First feedback session)</span> for Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span>" + " created.<br><span class=\"bold\">Distribute points " + "(among recipients) question:</span> Split points among students." + "|||/page/instructorFeedbackQuestionAdd";
    AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) RedirectResult(teammates.ui.controller.RedirectResult) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) InstructorFeedbackQuestionAddAction(teammates.ui.controller.InstructorFeedbackQuestionAddAction) Test(org.testng.annotations.Test)

Example 7 with InstructorFeedbackQuestionAddAction

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

the class InstructorFeedbackQuestionAddActionTest method testExecuteAndPostProcessRubricQuestion.

@Test
public void testExecuteAndPostProcessRubricQuestion() {
    InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
    gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
    ______TS("Typical case");
    // tests when descriptions are missing as well.
    FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
    String[] params = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, FeedbackParticipantType.STUDENTS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, "1", Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "RUBRIC", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "Please choose the most appropriate choices for the sub-questions below.", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_NUM_COLS, "2", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_NUM_ROWS, "2", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_SUBQUESTION + "-0", "SubQn-1", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_CHOICE + "-0", "Choice-1", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_WEIGHT + "-0", "-1", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_SUBQUESTION + "-1", "SubQn-2", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_CHOICE + "-1", "Choice-2", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_WEIGHT + "-1", "2", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIES, "1", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit" };
    InstructorFeedbackQuestionAddAction action = getAction(params);
    RedirectResult result = getRedirectResult(action);
    assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "First+feedback+session", instructor1ofCourse1.googleId, false), result.getDestinationWithParams());
    String expectedLogMessage = "TEAMMATESLOG|||instructorFeedbackQuestionAdd|||" + "instructorFeedbackQuestionAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||" + "idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + "Created Feedback Question for Feedback Session:<span class=\"bold\">" + "(First feedback session)</span> for Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span>" + " created.<br><span class=\"bold\">Rubric question:</span> " + "Please choose the most appropriate choices for the sub-questions below." + "|||/page/instructorFeedbackQuestionAdd";
    AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) RedirectResult(teammates.ui.controller.RedirectResult) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) InstructorFeedbackQuestionAddAction(teammates.ui.controller.InstructorFeedbackQuestionAddAction) Test(org.testng.annotations.Test)

Example 8 with InstructorFeedbackQuestionAddAction

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

the class InstructorFeedbackQuestionAddActionTest method testExecuteAndPostProcessContributionQuestion.

@Test
public void testExecuteAndPostProcessContributionQuestion() {
    InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
    gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
    ______TS("Typical case");
    FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
    String[] params = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, FeedbackParticipantType.STUDENTS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, "1", Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "CONTRIB", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "How much has each team member including yourself, contributed to the project?", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIES, "1", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit" };
    InstructorFeedbackQuestionAddAction action = getAction(params);
    RedirectResult result = getRedirectResult(action);
    assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "First+feedback+session", instructor1ofCourse1.googleId, false), result.getDestinationWithParams());
    String expectedLogMessage = "TEAMMATESLOG|||instructorFeedbackQuestionAdd|||" + "instructorFeedbackQuestionAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||" + "idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + "Created Feedback Question for Feedback Session:<span class=\"bold\">" + "(First feedback session)</span> for Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span>" + " created.<br><span class=\"bold\">Team contribution question:</span> " + "How much has each team member including yourself, contributed to the project?" + "|||/page/instructorFeedbackQuestionAdd";
    AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
    ______TS("Invalid giver case");
    params = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, FeedbackParticipantType.OWN_TEAM_MEMBERS_INCLUDING_SELF.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, "1", Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "CONTRIB", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "How much has each team member including yourself, contributed to the project?", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIES, "1", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit" };
    action = getAction(params);
    result = getRedirectResult(action);
    assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "First+feedback+session", instructor1ofCourse1.googleId, true), result.getDestinationWithParams());
    expectedLogMessage = "TEAMMATESLOG|||instructorFeedbackQuestionAdd|||" + "instructorFeedbackQuestionAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||" + "idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + "Created Feedback Question for Feedback Session:<span class=\"bold\">" + "(First feedback session)</span> for Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span>" + " created.<br><span class=\"bold\">Team contribution question:</span> " + "How much has each team member including yourself, contributed to the project?" + "|||/page/instructorFeedbackQuestionAdd";
    AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
    assertEquals(Const.FeedbackQuestion.CONTRIB_ERROR_INVALID_FEEDBACK_PATH + "<br>" + Const.StatusMessages.FEEDBACK_QUESTION_ADDED, result.getStatusMessage());
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) RedirectResult(teammates.ui.controller.RedirectResult) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) InstructorFeedbackQuestionAddAction(teammates.ui.controller.InstructorFeedbackQuestionAddAction) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)8 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)8 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)8 InstructorFeedbackQuestionAddAction (teammates.ui.controller.InstructorFeedbackQuestionAddAction)8 RedirectResult (teammates.ui.controller.RedirectResult)8