Search in sources :

Example 1 with StudentCourseJoinEmailWorkerAction

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());
}
Also used : StudentCourseJoinEmailWorkerAction(teammates.ui.automated.StudentCourseJoinEmailWorkerAction) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes) EmailWrapper(teammates.common.util.EmailWrapper) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)1 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)1 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)1 EmailWrapper (teammates.common.util.EmailWrapper)1 StudentCourseJoinEmailWorkerAction (teammates.ui.automated.StudentCourseJoinEmailWorkerAction)1