use of teammates.ui.automated.StudentCourseJoinEmailWorkerAction in project teammates by TEAMMATES.
the class StudentCourseJoinEmailWorkerActionTest method allTests.
@Test
public void allTests() {
CourseAttributes course1 = dataBundle.courses.get("typicalCourse1");
StudentAttributes stu1InCourse1 = dataBundle.students.get("student1InCourse1");
______TS("typical case: new student joining");
String[] submissionParams = new String[] { ParamsNames.COURSE_ID, course1.getId(), ParamsNames.STUDENT_EMAIL, stu1InCourse1.email, ParamsNames.IS_STUDENT_REJOINING, "false" };
StudentCourseJoinEmailWorkerAction action = getAction(submissionParams);
action.execute();
verifyNumberOfEmailsSent(action, 1);
EmailWrapper email = action.getEmailSender().getEmailsSent().get(0);
assertEquals(String.format(EmailType.STUDENT_COURSE_JOIN.getSubject(), course1.getName(), course1.getId()), email.getSubject());
assertEquals(stu1InCourse1.email, email.getRecipient());
______TS("typical case: old student rejoining (after google id reset)");
submissionParams = new String[] { ParamsNames.COURSE_ID, course1.getId(), ParamsNames.STUDENT_EMAIL, stu1InCourse1.email, ParamsNames.IS_STUDENT_REJOINING, "true" };
action = getAction(submissionParams);
action.execute();
verifyNumberOfEmailsSent(action, 1);
email = action.getEmailSender().getEmailsSent().get(0);
assertEquals(String.format(EmailType.STUDENT_COURSE_REJOIN_AFTER_GOOGLE_ID_RESET.getSubject(), course1.getName(), course1.getId()), email.getSubject());
assertEquals(stu1InCourse1.email, email.getRecipient());
}
Aggregations