Search in sources :

Example 36 with FeedbackSessionAttributes

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

the class InstructorFeedbackEditSaveActionTest method testAccessControl.

@Override
@Test
protected void testAccessControl() throws Exception {
    FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
    String[] submissionParams = createParamsForTypicalFeedbackSession(fs.getCourseId(), fs.getFeedbackSessionName());
    verifyUnaccessibleWithoutModifySessionPrivilege(submissionParams);
    verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) Test(org.testng.annotations.Test)

Example 37 with FeedbackSessionAttributes

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

the class InstructorFeedbackPreviewAsStudentActionTest method testAccessControl.

@Override
@Test
protected void testAccessControl() throws Exception {
    FeedbackSessionAttributes session = typicalBundle.feedbackSessions.get("session1InCourse1");
    StudentAttributes student = typicalBundle.students.get("student1InCourse1");
    String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.PREVIEWAS, student.email };
    verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) Test(org.testng.annotations.Test)

Example 38 with FeedbackSessionAttributes

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

the class InstructorFeedbackPublishActionTest method testExecuteAndPostProcess.

@Override
@Test
public void testExecuteAndPostProcess() throws Exception {
    gaeSimulation.loginAsInstructor(typicalBundle.instructors.get("instructor1OfCourse1").googleId);
    FeedbackSessionAttributes session = typicalBundle.feedbackSessions.get("session2InCourse1");
    String[] paramsNormal = { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName() };
    String[] paramsWithNullCourseId = { Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName() };
    String[] paramsWithNullFeedbackSessionName = { Const.ParamsNames.COURSE_ID, session.getCourseId() };
    ______TS("Typical successful case: session publishable");
    makeFeedbackSessionUnpublished(session);
    InstructorFeedbackPublishAction publishAction = getAction(paramsNormal);
    RedirectResult result = getRedirectResult(publishAction);
    String expectedDestination = getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE, false, "idOfInstructor1OfCourse1");
    assertEquals(expectedDestination, result.getDestinationWithParams());
    assertEquals(Const.StatusMessages.FEEDBACK_SESSION_PUBLISHED, result.getStatusMessage());
    assertFalse(result.isError);
    verifySpecifiedTasksAdded(publishAction, Const.TaskQueue.FEEDBACK_SESSION_PUBLISHED_EMAIL_QUEUE_NAME, 1);
    TaskWrapper taskAdded = publishAction.getTaskQueuer().getTasksAdded().get(0);
    Map<String, String[]> paramMap = taskAdded.getParamMap();
    assertEquals(session.getCourseId(), paramMap.get(ParamsNames.EMAIL_COURSE)[0]);
    assertEquals(session.getSessionName(), paramMap.get(ParamsNames.EMAIL_FEEDBACK)[0]);
    ______TS("Unsuccessful case 1: params with null course id");
    String errorMessage = "";
    publishAction = getAction(paramsWithNullCourseId);
    try {
        publishAction.executeAndPostProcess();
        signalFailureToDetectException("NullPostParameterException expected");
    } catch (NullPostParameterException e) {
        errorMessage = e.getMessage();
    }
    assertEquals(String.format(Const.StatusCodes.NULL_POST_PARAMETER, Const.ParamsNames.COURSE_ID), errorMessage);
    ______TS("Unsuccessful case 2: params with null feedback session name");
    errorMessage = "";
    publishAction = getAction(paramsWithNullFeedbackSessionName);
    try {
        publishAction.executeAndPostProcess();
        signalFailureToDetectException("NullPostParameterException expected");
    } catch (NullPostParameterException e) {
        errorMessage = e.getMessage();
    }
    assertEquals(String.format(Const.StatusCodes.NULL_POST_PARAMETER, Const.ParamsNames.FEEDBACK_SESSION_NAME), errorMessage);
    ______TS("Unsuccessful case 3: trying to publish a session not currently unpublished");
    makeFeedbackSessionPublished(session);
    publishAction = getAction(paramsNormal);
    result = getRedirectResult(publishAction);
    expectedDestination = getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE, true, "idOfInstructor1OfCourse1");
    assertEquals(expectedDestination, result.getDestinationWithParams());
    assertEquals("Error publishing feedback session: Session has already been published.", result.getStatusMessage());
    assertTrue(result.isError);
    verifyNoTasksAdded(publishAction);
    makeFeedbackSessionUnpublished(session);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) TaskWrapper(teammates.common.util.TaskWrapper) NullPostParameterException(teammates.common.exception.NullPostParameterException) InstructorFeedbackPublishAction(teammates.ui.controller.InstructorFeedbackPublishAction) RedirectResult(teammates.ui.controller.RedirectResult) Test(org.testng.annotations.Test)

Example 39 with FeedbackSessionAttributes

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

the class InstructorFeedbackQuestionAddActionTest method testExecuteAndPostProcessConstSumOption.

@Test
public void testExecuteAndPostProcessConstSumOption() {
    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.SELF.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, "1", Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "CONSTSUM", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "Split points among the options.", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTS, "30", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSFOREACHOPTION, "100", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSFOREACHRECIPIENT, "50", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMPOINTSPEROPTION, "true", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFCHOICECREATED, "3", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMOPTION + "-1", "Option 1", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMOPTION + "-2", "Option 2", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMOPTION + "-3", "Option 3", Const.ParamsNames.FEEDBACK_QUESTION_CONSTSUMTORECIPIENTS, "false", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIES, "1", 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 options) " + "question:</span> Split points among the options." + "|||/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 40 with FeedbackSessionAttributes

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

the class InstructorFeedbackQuestionAddActionTest method testExecuteAndPostProcess.

@Override
@Test
public void testExecuteAndPostProcess() {
    InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
    gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
    ______TS("Not enough parameters");
    verifyAssumptionFailure();
    FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
    String[] params = { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName() };
    verifyAssumptionFailure(params);
    ______TS("Empty questionText");
    params = createParamsForTypicalFeedbackQuestion(fs.getCourseId(), fs.getFeedbackSessionName());
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "");
    verifyAssumptionFailure(params);
    ______TS("Invalid questionNumber");
    params = createParamsForTypicalFeedbackQuestion(fs.getCourseId(), fs.getFeedbackSessionName());
    // change questionNumber to invalid number
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, "0");
    verifyAssumptionFailure(params);
    params = createParamsForTypicalFeedbackQuestion(fs.getCourseId(), fs.getFeedbackSessionName());
    // change questionNumber to invalid number
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, "-1");
    verifyAssumptionFailure(params);
    params = createParamsForTypicalFeedbackQuestion(fs.getCourseId(), fs.getFeedbackSessionName());
    // change questionNumber to invalid "number"
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, "ABC");
    try {
        InstructorFeedbackQuestionAddAction c = getAction(params);
        c.executeAndPostProcess();
        signalFailureToDetectException();
    } catch (NumberFormatException e) {
        ignoreExpectedException();
    }
    ______TS("Non-existent Enumeration");
    params = createParamsForTypicalFeedbackQuestion(instructor1ofCourse1.courseId, fs.getFeedbackSessionName());
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, "NON_EXISTENT_ENUMERATION");
    try {
        InstructorFeedbackQuestionAddAction c = getAction(params);
        c.executeAndPostProcess();
        signalFailureToDetectException();
    } catch (IllegalArgumentException e) {
        ignoreExpectedException();
    }
    params = createParamsForTypicalFeedbackQuestion(instructor1ofCourse1.courseId, fs.getFeedbackSessionName());
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, "NON_EXISTENT_ENUMERATION");
    try {
        InstructorFeedbackQuestionAddAction c = getAction(params);
        c.executeAndPostProcess();
        signalFailureToDetectException();
    } catch (IllegalArgumentException e) {
        ignoreExpectedException();
    }
    params = createParamsForTypicalFeedbackQuestion(instructor1ofCourse1.courseId, fs.getFeedbackSessionName());
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "NON_EXISTENT_ENUMERATION");
    try {
        InstructorFeedbackQuestionAddAction c = getAction(params);
        c.executeAndPostProcess();
        signalFailureToDetectException();
    } catch (IllegalArgumentException e) {
        ignoreExpectedException();
    }
    ______TS("Typical case");
    params = createParamsForTypicalFeedbackQuestion(fs.getCourseId(), fs.getFeedbackSessionName());
    // change number of feedback to give to unlimited
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max");
    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\">Essay question:</span> " + "question|||/page/instructorFeedbackQuestionAdd";
    AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
    ______TS("Custom number of students to give feedback to");
    params = createParamsForTypicalFeedbackQuestion(fs.getCourseId(), fs.getFeedbackSessionName());
    action = getAction(params);
    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());
    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\">Essay question:</span> " + "question|||/page/instructorFeedbackQuestionAdd";
    AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
    ______TS("Custom number of teams to give feedback to");
    params = createParamsForTypicalFeedbackQuestion(fs.getCourseId(), fs.getFeedbackSessionName());
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, "TEAMS");
    action = getAction(params);
    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());
    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\">Essay question:</span> " + "question|||/page/instructorFeedbackQuestionAdd";
    AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
    ______TS("Remnant custom number of entities when recipient is changed to non-student and non-team");
    params = createParamsForTypicalFeedbackQuestion(fs.getCourseId(), fs.getFeedbackSessionName());
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, "INSTRUCTORS");
    action = getAction(params);
    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());
    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\">Essay question:</span> " + "question|||/page/instructorFeedbackQuestionAdd";
    AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
    ______TS("Question text requires sanitization");
    params = createParamsForTypicalFeedbackQuestion(fs.getCourseId(), fs.getFeedbackSessionName());
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "attempted html injection '\"/>");
    action = getAction(params);
    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());
    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\">Essay question:</span> " + "attempted html injection &#39;&quot;&#x2f;&gt;|||/page/instructorFeedbackQuestionAdd";
    AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
    ______TS("Failure: Empty or null participant lists");
    params = createParamsForTypicalFeedbackQuestion(fs.getCourseId(), fs.getFeedbackSessionName());
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, "");
    // Purposely not using modifyParamVale because we're removing showRecipientTo
    params[22] = Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE;
    params[23] = "edit";
    params = Arrays.copyOf(params, 24);
    action = getAction(params);
    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());
    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\">Essay question:</span> " + "question|||/page/instructorFeedbackQuestionAdd";
    ______TS("Failure: Invalid Parameter");
    params = createParamsForTypicalFeedbackQuestion(instructor1ofCourse1.courseId, fs.getFeedbackSessionName());
    modifyParamValue(params, Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, "NONE");
    action = getAction(params);
    result = getRedirectResult(action);
    assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "First+feedback+session", instructor1ofCourse1.googleId, true), result.getDestinationWithParams());
    assertEquals("NONE is not a valid feedback giver.", result.getStatusMessage());
    expectedLogMessage = "TEAMMATESLOG|||instructorFeedbackQuestionAdd|||" + "instructorFeedbackQuestionAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||" + "idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + String.format(FieldValidator.PARTICIPANT_TYPE_ERROR_MESSAGE, "NONE", FieldValidator.GIVER_TYPE_NAME) + "|||/page/instructorFeedbackQuestionAdd";
    AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage());
    ______TS("Masquerade mode");
    String adminUserId = "admin.user";
    gaeSimulation.loginAsAdmin(adminUserId);
    params = createParamsForTypicalFeedbackQuestion(instructor1ofCourse1.courseId, fs.getFeedbackSessionName());
    params = addUserIdToParams(instructor1ofCourse1.googleId, params);
    action = getAction(params);
    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());
    expectedLogMessage = "TEAMMATESLOG|||instructorFeedbackQuestionAdd|||" + "instructorFeedbackQuestionAdd|||true|||" + "Instructor(M)|||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\">Essay question:</span> " + "question|||/page/instructorFeedbackQuestionAdd";
    AssertHelper.assertLogMessageEqualsInMasqueradeMode(expectedLogMessage, action.getLogMessage(), adminUserId);
}
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

FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)205 Test (org.testng.annotations.Test)85 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)78 ArrayList (java.util.ArrayList)47 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)35 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)32 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)30 RedirectResult (teammates.ui.controller.RedirectResult)27 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)21 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)19 StatusMessage (teammates.common.util.StatusMessage)19 HashMap (java.util.HashMap)17 InvalidParametersException (teammates.common.exception.InvalidParametersException)14 FeedbackResponsesDb (teammates.storage.api.FeedbackResponsesDb)13 EmailWrapper (teammates.common.util.EmailWrapper)12 Text (com.google.appengine.api.datastore.Text)11 DataBundle (teammates.common.datatransfer.DataBundle)11 EmailGenerator (teammates.logic.api.EmailGenerator)10 List (java.util.List)9 TaskWrapper (teammates.common.util.TaskWrapper)9