Search in sources :

Example 1 with InstructorFeedbackRemindParticularStudentsAction

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

the class InstructorFeedbackRemindParticularStudentsActionTest method testExecuteAndPostProcess.

@Override
@Test
public void testExecuteAndPostProcess() {
    InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
    FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
    StudentAttributes studentNotSubmitFeedback = typicalBundle.students.get("student5InCourse1");
    gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
    ______TS("Unsuccessful case: Not enough parameters");
    String[] paramsNoCourseId = new String[] { Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName() };
    verifyAssumptionFailure(paramsNoCourseId);
    String[] paramsNoFeedback = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId() };
    verifyAssumptionFailure(paramsNoFeedback);
    ______TS("Unsuccessful case: No user to remind, warning message generated");
    String[] paramsNoUserToRemind = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName() };
    InstructorFeedbackRemindParticularStudentsAction action = getAction(paramsNoUserToRemind);
    RedirectResult rr = getRedirectResult(action);
    assertTrue(rr.getStatusMessage().contains(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSEMPTYRECIPIENT));
    verifyNoTasksAdded(action);
    ______TS("Unsuccessful case: Feedback session not open, warning message generated");
    fs = typicalBundle.feedbackSessions.get("awaiting.session");
    String[] paramsFeedbackSessionNotOpen = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), Const.ParamsNames.SUBMISSION_REMIND_USERLIST, studentNotSubmitFeedback.getEmail() };
    action = getAction(paramsFeedbackSessionNotOpen);
    rr = getRedirectResult(action);
    assertTrue(rr.getStatusMessage().contains(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSESSIONNOTOPEN));
    verifyNoTasksAdded(action);
    ______TS("Successful case: Typical case");
    fs = typicalBundle.feedbackSessions.get("session1InCourse1");
    String[] paramsTypical = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getSessionName(), Const.ParamsNames.SUBMISSION_REMIND_USERLIST, studentNotSubmitFeedback.getEmail() };
    action = getAction(paramsTypical);
    rr = getRedirectResult(action);
    assertTrue(rr.getStatusMessage().contains(Const.StatusMessages.FEEDBACK_SESSION_REMINDERSSENT));
    verifySpecifiedTasksAdded(action, TaskQueue.FEEDBACK_SESSION_REMIND_PARTICULAR_USERS_EMAIL_QUEUE_NAME, 1);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) InstructorFeedbackRemindParticularStudentsAction(teammates.ui.controller.InstructorFeedbackRemindParticularStudentsAction) RedirectResult(teammates.ui.controller.RedirectResult) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)1 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)1 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)1 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)1 InstructorFeedbackRemindParticularStudentsAction (teammates.ui.controller.InstructorFeedbackRemindParticularStudentsAction)1 RedirectResult (teammates.ui.controller.RedirectResult)1