Search in sources :

Example 1 with FeedbackSessionRemindParticularUsersEmailWorkerAction

use of teammates.ui.automated.FeedbackSessionRemindParticularUsersEmailWorkerAction in project teammates by TEAMMATES.

the class FeedbackSessionRemindParticularUsersEmailWorkerActionTest method allTests.

@Test
public void allTests() {
    ______TS("Send feedback session reminder email");
    FeedbackSessionAttributes session1 = dataBundle.feedbackSessions.get("session1InCourse1");
    StudentAttributes student1 = dataBundle.students.get("student1InCourse1");
    InstructorAttributes instructor1 = dataBundle.instructors.get("instructor1OfCourse1");
    String[] submissionParams = new String[] { ParamsNames.SUBMISSION_FEEDBACK, session1.getFeedbackSessionName(), ParamsNames.SUBMISSION_COURSE, session1.getCourseId(), ParamsNames.SUBMISSION_REMIND_USERLIST, student1.email, ParamsNames.SUBMISSION_REMIND_USERLIST, instructor1.email, ParamsNames.USER_ID, instructor1.googleId, ParamsNames.SUBMISSION_REMIND_USERLIST, "non-existent" };
    FeedbackSessionRemindParticularUsersEmailWorkerAction action = getAction(submissionParams);
    action.execute();
    // send 3 emails as specified in the submission parameters
    verifySpecifiedTasksAdded(action, Const.TaskQueue.SEND_EMAIL_QUEUE_NAME, 3);
    String courseName = coursesLogic.getCourse(session1.getCourseId()).getName();
    List<TaskWrapper> tasksAdded = action.getTaskQueuer().getTasksAdded();
    for (TaskWrapper task : tasksAdded) {
        Map<String, String[]> paramMap = task.getParamMap();
        assertEquals(String.format(EmailType.FEEDBACK_SESSION_REMINDER.getSubject(), courseName, session1.getSessionName()), paramMap.get(ParamsNames.EMAIL_SUBJECT)[0]);
        String recipient = paramMap.get(ParamsNames.EMAIL_RECEIVER)[0];
        assertTrue(recipient.equals(student1.email) || recipient.equals(instructor1.email));
    }
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) TaskWrapper(teammates.common.util.TaskWrapper) FeedbackSessionRemindParticularUsersEmailWorkerAction(teammates.ui.automated.FeedbackSessionRemindParticularUsersEmailWorkerAction) 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 TaskWrapper (teammates.common.util.TaskWrapper)1 FeedbackSessionRemindParticularUsersEmailWorkerAction (teammates.ui.automated.FeedbackSessionRemindParticularUsersEmailWorkerAction)1