Search in sources :

Example 91 with FeedbackResponseAttributes

use of teammates.common.datatransfer.attributes.FeedbackResponseAttributes in project teammates by TEAMMATES.

the class StudentFeedbackSubmitPageUiTest method testInputValidation.

private void testInputValidation() {
    ______TS("Test InputValidation lower than Min value");
    // this should not give any error since the value will be automatically adjusted before the form is submitted
    // adjusted value should be 1
    logout();
    submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
    submitPage.fillResponseTextBox(14, 0, "");
    submitPage.fillResponseTextBox(14, 0, "0");
    submitPage.submitWithoutConfirmationEmail();
    submitPage.verifyAndCloseSuccessfulSubmissionModal();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    FeedbackQuestionAttributes fqNumscale = BackDoor.getFeedbackQuestion("SFSubmitUiT.CS2104", "First Session", 15);
    FeedbackResponseAttributes frNumscale = BackDoor.getFeedbackResponse(fqNumscale.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.alice.b@gmail.tmt");
    assertEquals("1", frNumscale.getResponseDetails().getAnswerString());
    ______TS("Test InputValidation Over Max value");
    // this should not give any error since the value will be automatically adjusted before the form is submitted
    // adjusted value should be 5
    submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
    submitPage.fillResponseTextBox(14, 0, "50000");
    submitPage.submitWithoutConfirmationEmail();
    submitPage.verifyAndCloseSuccessfulSubmissionModal();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    fqNumscale = BackDoor.getFeedbackQuestion("SFSubmitUiT.CS2104", "First Session", 15);
    frNumscale = BackDoor.getFeedbackResponse(fqNumscale.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.alice.b@gmail.tmt");
    assertEquals("5", frNumscale.getResponseDetails().getAnswerString());
    ______TS("Test InputValidation extreme negative value");
    /* Attention: in safari or chrome, negative sign "-" can be input so the result will be adjusted to 1
         *            However, in firefox, the sign "-" can not be typed into the text box so no negative
         *            value can be input
         */
    submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
    submitPage.fillResponseTextBox(14, 0, "-99999");
    submitPage.submitWithoutConfirmationEmail();
    submitPage.verifyAndCloseSuccessfulSubmissionModal();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    fqNumscale = BackDoor.getFeedbackQuestion("SFSubmitUiT.CS2104", "First Session", 15);
    frNumscale = BackDoor.getFeedbackResponse(fqNumscale.getId(), "SFSubmitUiT.alice.b@gmail.tmt", "SFSubmitUiT.alice.b@gmail.tmt");
    if ("firefox".equals(TestProperties.BROWSER)) {
        assertEquals("5", frNumscale.getResponseDetails().getAnswerString());
    } else {
        assertEquals("1", frNumscale.getResponseDetails().getAnswerString());
        // We need the final response value for this particular question to be "5"
        submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
        submitPage.fillResponseTextBox(14, 0, "5");
        submitPage.submitWithoutConfirmationEmail();
        submitPage.verifyAndCloseSuccessfulSubmissionModal();
        submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    }
    ______TS("write response without specifying recipient");
    submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
    submitPage.selectRecipient(2, 2, "");
    submitPage.fillResponseRichTextEditor(2, 2, "Response to no recipient");
    submitPage.submitWithoutConfirmationEmail();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals("You did not specify a recipient for your response in question 2.");
    ______TS("cannot choose self when generating choices from students (excluding self)");
    submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
    assertFalse(submitPage.checkIfMcqOrMsqChoiceExists(24, 0, "Alice Betsy</option></td></div>'\" (Team >'\"< 1</td></div>'\")"));
    assertTrue(submitPage.checkIfMcqOrMsqChoiceExists(24, 0, "Charlie Davis (Team 2)"));
    assertFalse(submitPage.checkIfMcqOrMsqChoiceExists(25, 0, "Alice Betsy</option></td></div>'\" (Team >'\"< 1</td></div>'\")"));
    assertTrue(submitPage.checkIfMcqOrMsqChoiceExists(25, 0, "Charlie Davis (Team 2)"));
    assertTrue(submitPage.checkIfMcqOrMsqChoiceExists(25, 0, "Extra guy (Team 2)"));
    submitPage.submitWithoutConfirmationEmail();
    submitPage.verifyAndCloseSuccessfulSubmissionModal();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    ______TS("cannot choose self when generating choices from teams (excluding self)");
    submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
    assertFalse(submitPage.checkIfMcqOrMsqChoiceExists(26, 0, "Team 1"));
    assertTrue(submitPage.checkIfMcqOrMsqChoiceExists(26, 0, "Team 2"));
    assertFalse(submitPage.checkIfMcqOrMsqChoiceExists(27, 0, "Team 1"));
    assertTrue(submitPage.checkIfMcqOrMsqChoiceExists(27, 0, "Team 2"));
    submitPage.submitWithoutConfirmationEmail();
    submitPage.verifyAndCloseSuccessfulSubmissionModal();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
}
Also used : FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)

Example 92 with FeedbackResponseAttributes

use of teammates.common.datatransfer.attributes.FeedbackResponseAttributes in project teammates by TEAMMATES.

the class StudentFeedbackSubmitPageUiTest method testModifyData.

private void testModifyData() throws Exception {
    ______TS("modify data");
    // Next, we edit some student data to cover editing of students
    // after creating the responses.
    // move one student out of Team 2 into a new team
    // This should cause the page to render an extra response box for
    // the team question.
    StudentAttributes extraGuy = testData.students.get("ExtraGuy");
    moveToTeam(extraGuy, "New Team");
    // delete one student
    // This should remove (hide on page render; not deleted) the response made to him,
    // and change the number of options in the recipient dropdown list.
    StudentAttributes dropOutGuy = testData.students.get("DropOut");
    String backDoorOperationStatus = BackDoor.deleteStudent(dropOutGuy.course, dropOutGuy.email);
    assertEquals(Const.StatusCodes.BACKDOOR_STATUS_SUCCESS, backDoorOperationStatus);
    // move Benny out of Team >'"< 1 into team 2 and change her email
    // This should cause the team mates question to disappear completely as
    // no one else is in Team >'"< 1, but other responses to Benny should remain.
    StudentAttributes benny = testData.students.get("Benny");
    moveToTeam(benny, "Team 2");
    submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
    submitPage.verifyHtmlMainContent("/studentFeedbackSubmitPageModified.html");
    // verify submission with no-response questions are possible
    submitPage.fillResponseTextBox(19, 2, "100");
    submitPage.submitWithoutConfirmationEmail();
    submitPage.verifyAndCloseSuccessfulSubmissionModal();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    ______TS("Responses with invalid recipients do not prevent submission");
    StudentAttributes alice = testData.students.get("Alice");
    FeedbackQuestionAttributes questionFromDataBundle = testData.feedbackQuestions.get("qn4InSession1");
    FeedbackQuestionAttributes question = BackDoor.getFeedbackQuestion(questionFromDataBundle.courseId, questionFromDataBundle.feedbackSessionName, questionFromDataBundle.questionNumber);
    FeedbackResponseAttributes existingResponse = BackDoor.getFeedbackResponse(question.getId(), alice.team, "Team 2");
    FeedbackResponseAttributes response = new FeedbackResponseAttributes(existingResponse);
    response.recipient = "invalidRecipient";
    String backDoorStatusForCreatingResponse = BackDoor.createFeedbackResponse(response);
    assertEquals(Const.StatusCodes.BACKDOOR_STATUS_SUCCESS, backDoorStatusForCreatingResponse);
    submitPage = loginToStudentFeedbackSubmitPage("Alice", "Open Session");
    submitPage.submitWithoutConfirmationEmail();
    // verify that existing responses with invalid recipients do not affect submission
    submitPage.verifyAndCloseSuccessfulSubmissionModal();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
}
Also used : FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes)

Example 93 with FeedbackResponseAttributes

use of teammates.common.datatransfer.attributes.FeedbackResponseAttributes in project teammates by TEAMMATES.

the class InstructorEditInstructorFeedbackSaveActionTest method testSubmitResponseForInvalidQuestion.

private void testSubmitResponseForInvalidQuestion() {
    FeedbackQuestionsDb fqDb = new FeedbackQuestionsDb();
    FeedbackQuestionAttributes fq;
    FeedbackResponsesDb frDb = new FeedbackResponsesDb();
    FeedbackResponseAttributes fr;
    InstructorAttributes instructor = dataBundle.instructors.get("IEIFPTCourseinstr");
    InstructorEditInstructorFeedbackSaveAction editInstructorFsAction;
    String moderatedInstructorEmail = "IEIFPTCoursehelper1@gmail.tmt";
    String[] submissionParams;
    gaeSimulation.loginAsInstructor(instructor.googleId);
    ______TS("Failure case: submit response for question in session, but should not be editable by instructor " + "(unable to see recipient)");
    fq = fqDb.getFeedbackQuestion("First feedback session", "IEIFPTCourse", 4);
    assertNotNull("Feedback question not found in database", fq);
    fr = dataBundle.feedbackResponses.get("response1ForQ4");
    fr = frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
    assertNotNull("Feedback response not found in database", fr);
    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 };
    try {
        editInstructorFsAction = getAction(submissionParams);
        editInstructorFsAction.executeAndPostProcess();
        signalFailureToDetectException("Did not detect that this instructor cannot access this particular question.");
    } catch (UnauthorizedAccessException e) {
        assertEquals("Feedback session [First feedback session] question [" + fr.feedbackQuestionId + "] " + "is not accessible to instructor [" + instructor.email + "]", e.getMessage());
    }
    ______TS("Failure case: submit response for question in session, but should not be editable by instructor " + "(unable to see giver)");
    fq = fqDb.getFeedbackQuestion("First feedback session", "IEIFPTCourse", 5);
    assertNotNull("Feedback question not found in database", fq);
    fr = dataBundle.feedbackResponses.get("response1ForQ5");
    fr = frDb.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
    assertNotNull("Feedback response not found in database", fr);
    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 };
    try {
        editInstructorFsAction = getAction(submissionParams);
        editInstructorFsAction.executeAndPostProcess();
        signalFailureToDetectException("Did not detect that this instructor cannot access this particular question.");
    } catch (UnauthorizedAccessException e) {
        assertEquals("Feedback session [First feedback session] question [" + fr.feedbackQuestionId + "] " + "is not accessible to instructor [" + instructor.email + "]", e.getMessage());
    }
}
Also used : FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) InstructorEditInstructorFeedbackSaveAction(teammates.ui.controller.InstructorEditInstructorFeedbackSaveAction) UnauthorizedAccessException(teammates.common.exception.UnauthorizedAccessException) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) FeedbackResponsesDb(teammates.storage.api.FeedbackResponsesDb) FeedbackQuestionsDb(teammates.storage.api.FeedbackQuestionsDb) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 94 with FeedbackResponseAttributes

use of teammates.common.datatransfer.attributes.FeedbackResponseAttributes 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);
}
Also used : FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) RedirectResult(teammates.ui.controller.RedirectResult) InstructorEditInstructorFeedbackSaveAction(teammates.ui.controller.InstructorEditInstructorFeedbackSaveAction) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) FeedbackResponsesDb(teammates.storage.api.FeedbackResponsesDb) FeedbackQuestionsDb(teammates.storage.api.FeedbackQuestionsDb) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 95 with FeedbackResponseAttributes

use of teammates.common.datatransfer.attributes.FeedbackResponseAttributes 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));
}
Also used : FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) RedirectResult(teammates.ui.controller.RedirectResult) InstructorEditInstructorFeedbackSaveAction(teammates.ui.controller.InstructorEditInstructorFeedbackSaveAction) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) FeedbackResponsesDb(teammates.storage.api.FeedbackResponsesDb) FeedbackQuestionsDb(teammates.storage.api.FeedbackQuestionsDb) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Aggregations

FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)143 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)70 ArrayList (java.util.ArrayList)63 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)36 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)35 List (java.util.List)29 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)28 HashMap (java.util.HashMap)27 FeedbackResponseCommentAttributes (teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes)22 HashSet (java.util.HashSet)20 LinkedHashMap (java.util.LinkedHashMap)20 Map (java.util.Map)18 Test (org.testng.annotations.Test)18 FeedbackQuestionsDb (teammates.storage.api.FeedbackQuestionsDb)18 FeedbackResponsesDb (teammates.storage.api.FeedbackResponsesDb)18 Text (com.google.appengine.api.datastore.Text)15 Set (java.util.Set)11 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)10 Comparator (java.util.Comparator)9 FeedbackParticipantType (teammates.common.datatransfer.FeedbackParticipantType)9