Search in sources :

Example 36 with ShowPageResult

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

the class InstructorFeedbackPreviewAsStudentActionTest method testExecuteAndPostProcess.

@Override
@Test
public void testExecuteAndPostProcess() {
    InstructorAttributes instructor = typicalBundle.instructors.get("instructor1OfCourse1");
    InstructorAttributes instructorHelper = typicalBundle.instructors.get("helperOfCourse1");
    String idOfInstructor = instructor.googleId;
    String idOfInstructorHelper = instructorHelper.googleId;
    StudentAttributes student = typicalBundle.students.get("student1InCourse1");
    gaeSimulation.loginAsInstructor(idOfInstructor);
    ______TS("typical success case");
    String feedbackSessionName = "First feedback session";
    String courseId = student.course;
    String previewAsEmail = student.email;
    String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName, Const.ParamsNames.PREVIEWAS, previewAsEmail };
    InstructorFeedbackPreviewAsStudentAction paia = getAction(submissionParams);
    ShowPageResult showPageResult = getShowPageResult(paia);
    assertEquals(getPageResultDestination(Const.ViewURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT, false, idOfInstructor), showPageResult.getDestinationWithParams());
    assertEquals("", showPageResult.getStatusMessage());
    AssertHelper.assertLogMessageEquals("TEAMMATESLOG|||instructorFeedbackPreviewAsStudent|||instructorFeedbackPreviewAsStudent" + "|||true|||Instructor|||Instructor 1 of Course 1|||idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + "Preview feedback session as student (" + student.email + ")<br>" + "Session Name: First feedback session<br>Course ID: idOfTypicalCourse1|||" + "/page/instructorFeedbackPreviewAsStudent", paia.getLogMessage());
    gaeSimulation.loginAsInstructor(idOfInstructorHelper);
    ______TS("failure: not enough privilege");
    feedbackSessionName = "First feedback session";
    courseId = "idOfTypicalCourse1";
    previewAsEmail = student.email;
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName, Const.ParamsNames.PREVIEWAS, previewAsEmail };
    try {
        paia = getAction(submissionParams);
        showPageResult = getShowPageResult(paia);
    } catch (UnauthorizedAccessException e) {
        assertEquals("Feedback session [First feedback session] is not accessible to instructor [" + instructorHelper.email + "] for privilege [canmodifysession]", e.getMessage());
    }
    gaeSimulation.loginAsInstructor(idOfInstructor);
    ______TS("failure: non-existent previewas email");
    previewAsEmail = "non-exIstentEmail@gsail.tmt";
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName, Const.ParamsNames.PREVIEWAS, previewAsEmail };
    try {
        paia = getAction(submissionParams);
        showPageResult = getShowPageResult(paia);
        signalFailureToDetectException();
    } catch (EntityNotFoundException enfe) {
        assertEquals("Student Email " + previewAsEmail + " does not exist in " + courseId + ".", enfe.getMessage());
    }
}
Also used : ShowPageResult(teammates.ui.controller.ShowPageResult) UnauthorizedAccessException(teammates.common.exception.UnauthorizedAccessException) EntityNotFoundException(teammates.common.exception.EntityNotFoundException) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorFeedbackPreviewAsStudentAction(teammates.ui.controller.InstructorFeedbackPreviewAsStudentAction) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) Test(org.testng.annotations.Test)

Example 37 with ShowPageResult

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

the class InstructorCourseEnrollPageActionTest method visitEnrollPage_inMasqueradeMode.

private void visitEnrollPage_inMasqueradeMode() {
    ______TS("Masquerade mode");
    gaeSimulation.loginAsAdmin("admin.user");
    InstructorAttributes instructorToMasquerade = typicalBundle.instructors.get("instructor4");
    String instructorId = instructorToMasquerade.googleId;
    String courseId = instructorToMasquerade.courseId;
    String[] submissionParams = new String[] { Const.ParamsNames.USER_ID, instructorId, Const.ParamsNames.COURSE_ID, courseId };
    InstructorCourseEnrollPageAction enrollPageAction = getAction(submissionParams);
    ShowPageResult pageResult = getShowPageResult(enrollPageAction);
    assertEquals(getPageResultDestination(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL, false, "idOfInstructor4"), pageResult.getDestinationWithParams());
    assertFalse(pageResult.isError);
    assertEquals("", pageResult.getStatusMessage());
    InstructorCourseEnrollPageData pageData = (InstructorCourseEnrollPageData) pageResult.data;
    assertEquals(courseId, pageData.getCourseId());
    assertNull(pageData.getEnrollStudents());
    String expectedLogSegment = String.format(Const.StatusMessages.ADMIN_LOG_INSTRUCTOR_COURSE_ENROLL_PAGE_LOAD, courseId);
    AssertHelper.assertContains(expectedLogSegment, enrollPageAction.getLogMessage());
}
Also used : InstructorCourseEnrollPageAction(teammates.ui.controller.InstructorCourseEnrollPageAction) ShowPageResult(teammates.ui.controller.ShowPageResult) InstructorCourseEnrollPageData(teammates.ui.pagedata.InstructorCourseEnrollPageData) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 38 with ShowPageResult

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

the class InstructorCourseJoinActionTest method testExecuteAndPostProcess.

@SuppressWarnings("deprecation")
@Override
@Test
public void testExecuteAndPostProcess() throws Exception {
    InstructorAttributes instructor = typicalBundle.instructors.get("instructor1OfCourse1");
    InstructorsDb instrDb = new InstructorsDb();
    // Reassign to let "key" variable in "instructor" not to be null
    instructor = instrDb.getInstructorForGoogleId(instructor.courseId, instructor.googleId);
    String invalidEncryptedKey = StringHelper.encrypt("invalidKey");
    gaeSimulation.loginAsInstructor(instructor.googleId);
    ______TS("Invalid key, redirect for confirmation again");
    String[] submissionParams = new String[] { Const.ParamsNames.REGKEY, invalidEncryptedKey };
    InstructorCourseJoinAction confirmAction = getAction(submissionParams);
    ShowPageResult pageResult = getShowPageResult(confirmAction);
    assertEquals(getPageResultDestination(Const.ViewURIs.INSTRUCTOR_COURSE_JOIN_CONFIRMATION, false, "idOfInstructor1OfCourse1", invalidEncryptedKey), pageResult.getDestinationWithParams());
    assertFalse(pageResult.isError);
    assertEquals("", pageResult.getStatusMessage());
    String expectedLogSegment = "Action Instructor Clicked Join Link" + "<br>Google ID: " + instructor.googleId + "<br>Key: " + invalidEncryptedKey;
    AssertHelper.assertContains(expectedLogSegment, confirmAction.getLogMessage());
    ______TS("Already registered instructor, redirect straight to authentication page");
    submissionParams = new String[] { Const.ParamsNames.REGKEY, StringHelper.encrypt(instructor.key) };
    confirmAction = getAction(submissionParams);
    RedirectResult redirectResult = getRedirectResult(confirmAction);
    assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_COURSE_JOIN_AUTHENTICATED, StringHelper.encrypt(instructor.key), false, "idOfInstructor1OfCourse1"), redirectResult.getDestinationWithParams());
    assertFalse(redirectResult.isError);
    assertEquals("", redirectResult.getStatusMessage());
    expectedLogSegment = "Action Instructor Clicked Join Link" + "<br>Google ID: " + instructor.googleId + "<br>Key: " + StringHelper.encrypt(instructor.key);
    AssertHelper.assertContains(expectedLogSegment, confirmAction.getLogMessage());
    ______TS("Typical case: unregistered instructor, redirect to confirmation page");
    instructor = InstructorAttributes.builder(null, instructor.courseId, "New Instructor", "ICJAT.instr@email.com").build();
    InstructorsLogic.inst().createInstructor(instructor);
    instructor.googleId = "ICJAT.instr";
    AccountAttributes newInstructorAccount = AccountAttributes.builder().withGoogleId(instructor.googleId).withName(instructor.name).withEmail(instructor.email).withInstitute("TEAMMATES Test Institute 5").withIsInstructor(false).withDefaultStudentProfileAttributes(instructor.googleId).build();
    AccountsLogic.inst().createAccount(newInstructorAccount);
    InstructorAttributes newInstructor = instrDb.getInstructorForEmail(instructor.courseId, instructor.email);
    gaeSimulation.loginUser(instructor.googleId);
    submissionParams = new String[] { Const.ParamsNames.REGKEY, StringHelper.encrypt(newInstructor.key) };
    confirmAction = getAction(submissionParams);
    pageResult = getShowPageResult(confirmAction);
    assertEquals(getPageResultDestination(Const.ViewURIs.INSTRUCTOR_COURSE_JOIN_CONFIRMATION, false, "ICJAT.instr", StringHelper.encrypt(newInstructor.key)), pageResult.getDestinationWithParams());
    assertFalse(pageResult.isError);
    assertEquals("", pageResult.getStatusMessage());
    expectedLogSegment = "Action Instructor Clicked Join Link" + "<br>Google ID: " + instructor.googleId + "<br>Key: " + StringHelper.encrypt(newInstructor.key);
    AssertHelper.assertContains(expectedLogSegment, confirmAction.getLogMessage());
}
Also used : InstructorsDb(teammates.storage.api.InstructorsDb) ShowPageResult(teammates.ui.controller.ShowPageResult) AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) InstructorCourseJoinAction(teammates.ui.controller.InstructorCourseJoinAction) RedirectResult(teammates.ui.controller.RedirectResult) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) Test(org.testng.annotations.Test)

Example 39 with ShowPageResult

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

the class InstructorFeedbackQuestionCopyPageActionTest method testExecuteAndPostProcess.

@Override
@Test
public void testExecuteAndPostProcess() {
    InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
    gaeSimulation.loginAsInstructor(instructor1OfCourse1.googleId);
    ______TS("typical success case");
    FeedbackSessionAttributes feedbackSessionAttributes = typicalBundle.feedbackSessions.get("session1InCourse1");
    String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackSessionAttributes.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionAttributes.getFeedbackSessionName() };
    InstructorFeedbackQuestionCopyPageAction action = getAction(submissionParams);
    ShowPageResult result = getShowPageResult(action);
    String expectedString = getPageResultDestination(Const.ViewURIs.INSTRUCTOR_FEEDBACK_QUESTION_COPY_MODAL, false, instructor1OfCourse1.googleId);
    assertEquals(expectedString, result.getDestinationWithParams());
    assertTrue(result.getStatusMessage().isEmpty());
    ______TS("failure: non-existent feedback session");
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackSessionAttributes.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, "Non-existent Session Name" };
    action = getAction(submissionParams);
    try {
        result = getShowPageResult(action);
        signalFailureToDetectException();
    } catch (UnauthorizedAccessException uae) {
        assertEquals("Trying to access system using a non-existent feedback session entity", uae.getMessage());
    }
    ______TS("failure: unsufficient permissions");
    gaeSimulation.loginAsInstructor(typicalBundle.accounts.get("helperOfCourse1").googleId);
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, feedbackSessionAttributes.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionAttributes.getFeedbackSessionName() };
    action = getAction(submissionParams);
    try {
        result = getShowPageResult(action);
        signalFailureToDetectException();
    } catch (UnauthorizedAccessException uae) {
        assertEquals("Feedback session [First feedback session] is not accessible " + "to instructor [helper@course1.tmt] for privilege [canmodifysession]", uae.getMessage());
    }
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) ShowPageResult(teammates.ui.controller.ShowPageResult) UnauthorizedAccessException(teammates.common.exception.UnauthorizedAccessException) InstructorFeedbackQuestionCopyPageAction(teammates.ui.controller.InstructorFeedbackQuestionCopyPageAction) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) Test(org.testng.annotations.Test)

Example 40 with ShowPageResult

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

the class InstructorFeedbackResponseCommentAddActionTest method testExecuteAndPostProcess.

@Override
@Test
public void testExecuteAndPostProcess() throws Exception {
    FeedbackQuestionsDb feedbackQuestionsDb = new FeedbackQuestionsDb();
    FeedbackResponsesDb feedbackResponsesDb = new FeedbackResponsesDb();
    FeedbackSessionAttributes session = typicalBundle.feedbackSessions.get("session1InCourse1");
    int questionNumber = 1;
    FeedbackQuestionAttributes question = feedbackQuestionsDb.getFeedbackQuestion(session.getFeedbackSessionName(), session.getCourseId(), questionNumber);
    String giverEmail = "student1InCourse1@gmail.tmt";
    String receiverEmail = "student1InCourse1@gmail.tmt";
    FeedbackResponseAttributes response = feedbackResponsesDb.getFeedbackResponse(question.getId(), giverEmail, receiverEmail);
    InstructorAttributes instructor = typicalBundle.instructors.get("instructor1OfCourse1");
    gaeSimulation.loginAsInstructor(instructor.googleId);
    ______TS("Unsuccessful case: not enough parameters");
    verifyAssumptionFailure();
    String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Comment to first response" };
    verifyAssumptionFailure(submissionParams);
    ______TS("typical successful case for unpublished session");
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Comment to first response", Const.ParamsNames.FEEDBACK_QUESTION_ID, question.getId(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, response.getId(), Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "GIVER,INSTRUCTORS", Const.ParamsNames.COMMENT_ID, "1-1-1-1" };
    InstructorFeedbackResponseCommentAddAction action = getAction(submissionParams);
    ShowPageResult result = getShowPageResult(action);
    InstructorFeedbackResponseCommentAjaxPageData data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
    assertFalse(data.isError);
    assertEquals("", result.getStatusMessage());
    ______TS("typical successful case for unpublished session empty giver permissions");
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Empty giver permissions", Const.ParamsNames.FEEDBACK_QUESTION_ID, question.getId(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, response.getId(), Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWGIVERTO, "", Const.ParamsNames.COMMENT_ID, "1-1-1-1" };
    action = getAction(submissionParams);
    result = getShowPageResult(action);
    data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
    assertFalse(data.isError);
    assertEquals("", result.getStatusMessage());
    ______TS("typical successful case for unpublished session shown to various recipients");
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Null comment permissions", Const.ParamsNames.FEEDBACK_QUESTION_ID, question.getId(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, response.getId(), Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.COMMENT_ID, "1-1-1-1" };
    action = getAction(submissionParams);
    result = getShowPageResult(action);
    data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
    assertFalse(data.isError);
    assertEquals("", result.getStatusMessage());
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Empty comment permissions", Const.ParamsNames.FEEDBACK_QUESTION_ID, question.getId(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, response.getId(), Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "", Const.ParamsNames.COMMENT_ID, "1-1-1-1" };
    action = getAction(submissionParams);
    result = getShowPageResult(action);
    data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
    assertFalse(data.isError);
    assertEquals("", result.getStatusMessage());
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Comment shown to giver", Const.ParamsNames.FEEDBACK_QUESTION_ID, question.getId(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, response.getId(), Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "GIVER", Const.ParamsNames.COMMENT_ID, "1-1-1-1" };
    action = getAction(submissionParams);
    result = getShowPageResult(action);
    data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
    assertFalse(data.isError);
    assertEquals("", result.getStatusMessage());
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Comment shown to receiver", Const.ParamsNames.FEEDBACK_QUESTION_ID, question.getId(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, response.getId(), Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "RECEIVER", Const.ParamsNames.COMMENT_ID, "1-1-1-1" };
    action = getAction(submissionParams);
    result = getShowPageResult(action);
    data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
    assertFalse(data.isError);
    assertEquals("", result.getStatusMessage());
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Comment shown to own team members", Const.ParamsNames.FEEDBACK_QUESTION_ID, question.getId(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, response.getId(), Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "OWN_TEAM_MEMBERS", Const.ParamsNames.COMMENT_ID, "1-1-1-1" };
    action = getAction(submissionParams);
    result = getShowPageResult(action);
    data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
    assertFalse(data.isError);
    assertEquals("", result.getStatusMessage());
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Comment shown to receiver team members", Const.ParamsNames.FEEDBACK_QUESTION_ID, question.getId(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, response.getId(), Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "RECEIVER_TEAM_MEMBERS", Const.ParamsNames.COMMENT_ID, "1-1-1-1" };
    action = getAction(submissionParams);
    result = getShowPageResult(action);
    data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
    assertFalse(data.isError);
    assertEquals("", result.getStatusMessage());
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Comment shown to students", Const.ParamsNames.FEEDBACK_QUESTION_ID, question.getId(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, response.getId(), Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "STUDENTS", Const.ParamsNames.COMMENT_ID, "1-1-1-1" };
    action = getAction(submissionParams);
    result = getShowPageResult(action);
    data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
    assertFalse(data.isError);
    assertEquals("", result.getStatusMessage());
    ______TS("typical successful case for published session");
    FeedbackSessionsLogic.inst().publishFeedbackSession(session);
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "Comment to first response, published session", Const.ParamsNames.FEEDBACK_QUESTION_ID, question.getId(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, response.getId(), Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.RESPONSE_COMMENTS_SHOWCOMMENTSTO, "GIVER,INSTRUCTORS", Const.ParamsNames.RESPONSE_COMMENTS_SHOWGIVERTO, "GIVER,INSTRUCTORS", Const.ParamsNames.COMMENT_ID, "1-1-1-1" };
    action = getAction(submissionParams);
    result = getShowPageResult(action);
    data = (InstructorFeedbackResponseCommentAjaxPageData) result.data;
    assertFalse(data.isError);
    assertEquals("", result.getStatusMessage());
    ______TS("Unsuccessful case: empty comment text");
    submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_RESPONSE_COMMENT_TEXT, "", Const.ParamsNames.FEEDBACK_QUESTION_ID, question.getId(), Const.ParamsNames.FEEDBACK_RESPONSE_ID, response.getId(), Const.ParamsNames.FEEDBACK_RESULTS_SORTTYPE, "recipient", Const.ParamsNames.COMMENT_ID, "1-1-1-1" };
    action = getAction(submissionParams);
    AjaxResult ajaxResult = getAjaxResult(action);
    assertEquals("", ajaxResult.getStatusMessage());
    data = (InstructorFeedbackResponseCommentAjaxPageData) ajaxResult.data;
    assertTrue(data.isError);
    assertEquals(Const.StatusMessages.FEEDBACK_RESPONSE_COMMENT_EMPTY, data.errorMessage);
}
Also used : FeedbackResponsesDb(teammates.storage.api.FeedbackResponsesDb) InstructorFeedbackResponseCommentAjaxPageData(teammates.ui.pagedata.InstructorFeedbackResponseCommentAjaxPageData) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) AjaxResult(teammates.ui.controller.AjaxResult) ShowPageResult(teammates.ui.controller.ShowPageResult) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) InstructorFeedbackResponseCommentAddAction(teammates.ui.controller.InstructorFeedbackResponseCommentAddAction) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) FeedbackQuestionsDb(teammates.storage.api.FeedbackQuestionsDb) Test(org.testng.annotations.Test)

Aggregations

ShowPageResult (teammates.ui.controller.ShowPageResult)51 Test (org.testng.annotations.Test)42 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)31 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)15 RedirectResult (teammates.ui.controller.RedirectResult)10 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)8 UnauthorizedAccessException (teammates.common.exception.UnauthorizedAccessException)8 EntityNotFoundException (teammates.common.exception.EntityNotFoundException)5 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)4 NullPostParameterException (teammates.common.exception.NullPostParameterException)4 ArrayList (java.util.ArrayList)3 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)3 AdminActivityLogPageAction (teammates.ui.controller.AdminActivityLogPageAction)3 AdminEmailLogPageAction (teammates.ui.controller.AdminEmailLogPageAction)3 AjaxResult (teammates.ui.controller.AjaxResult)3 InstructorCourseEnrollPageAction (teammates.ui.controller.InstructorCourseEnrollPageAction)3 InstructorCourseEnrollPageData (teammates.ui.pagedata.InstructorCourseEnrollPageData)3 Instant (java.time.Instant)2 AdminEmailAttributes (teammates.common.datatransfer.attributes.AdminEmailAttributes)2 StudentProfileAttributes (teammates.common.datatransfer.attributes.StudentProfileAttributes)2