use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class InstructorCourseJoinEmailWorkerActionTest method allTests.
@Test
public void allTests() {
CourseAttributes course1 = dataBundle.courses.get("typicalCourse1");
InstructorAttributes instr1InCourse1 = dataBundle.instructors.get("instructor1OfCourse1");
AccountAttributes inviter = AccountsLogic.inst().getAccount("idOfInstructor2OfCourse1");
String[] submissionParams = new String[] { ParamsNames.COURSE_ID, course1.getId(), ParamsNames.INSTRUCTOR_EMAIL, instr1InCourse1.email, ParamsNames.INVITER_ID, inviter.googleId };
InstructorCourseJoinEmailWorkerAction action = getAction(submissionParams);
action.execute();
verifyNumberOfEmailsSent(action, 1);
EmailWrapper email = action.getEmailSender().getEmailsSent().get(0);
assertEquals(String.format(EmailType.INSTRUCTOR_COURSE_JOIN.getSubject(), course1.getName(), course1.getId()), email.getSubject());
assertEquals(instr1InCourse1.email, email.getRecipient());
}
use of teammates.common.datatransfer.attributes.CourseAttributes 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());
}
use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackRemindParticularStudentsPageActionTest method testAccessControl.
@Test
@Override
protected void testAccessControl() throws Exception {
CourseAttributes course = typicalBundle.courses.get("typicalCourse1");
FeedbackSessionAttributes fsa = typicalBundle.feedbackSessions.get("session1InCourse1");
String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, course.getId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fsa.getFeedbackSessionName() };
verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams);
}
use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackRemindParticularStudentsPageActionTest method testExecuteAndPostProcess.
@Override
@Test
public void testExecuteAndPostProcess() {
InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
String instructorId = instructor1OfCourse1.googleId;
CourseAttributes course = typicalBundle.courses.get("typicalCourse1");
FeedbackSessionAttributes fsa = typicalBundle.feedbackSessions.get("session1InCourse1");
gaeSimulation.loginAsInstructor(instructorId);
______TS("Not enough parameters");
verifyAssumptionFailure();
______TS("Typical case");
String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, course.getId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fsa.getFeedbackSessionName() };
InstructorFeedbackRemindParticularStudentsPageAction a = getAction(submissionParams);
ShowPageResult r = getShowPageResult(a);
assertFalse(r.isError);
assertEquals("", r.getStatusMessage());
InstructorFeedbackRemindParticularStudentsPageData pageData = (InstructorFeedbackRemindParticularStudentsPageData) r.data;
assertEquals(6, pageData.getResponseStatus().studentsWhoDidNotRespond.size());
assertEquals(3, pageData.getResponseStatus().studentsWhoResponded.size());
assertTrue(pageData.getResponseStatus().studentsWhoResponded.contains("student1InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("student2InCourse1@gmail.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoResponded.contains("student3InCourse1@gmail.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("student4InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoResponded.contains("student5InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("student6InCourse1@gmail.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("instructor1@course1.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("instructor2@course1.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("instructor3@course1.tmt"));
assertFalse(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("instructor4@course1.tmt"));
assertTrue(pageData.getResponseStatus().studentsWhoDidNotRespond.contains("helper@course1.tmt"));
}
use of teammates.common.datatransfer.attributes.CourseAttributes in project teammates by TEAMMATES.
the class InstructorStudentRecordsAjaxPageActionTest method testAccessControl.
@Test
@Override
protected void testAccessControl() throws Exception {
InstructorAttributes instructor = typicalBundle.instructors.get("instructor3OfCourse1");
StudentAttributes student = typicalBundle.students.get("student2InCourse1");
CourseAttributes course = typicalBundle.courses.get("typicalCourse1");
String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, course.getId(), Const.ParamsNames.STUDENT_EMAIL, student.email, Const.ParamsNames.FEEDBACK_SESSION_NAME, "First feedback session" };
verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams);
______TS("Instructor cannot view sections without View-Student-In-Sections privilege");
instructor = typicalBundle.instructors.get("helperOfCourse1");
gaeSimulation.loginAsInstructor(instructor.googleId);
submissionParams = new String[] { Const.ParamsNames.COURSE_ID, course.getId(), Const.ParamsNames.STUDENT_EMAIL, student.email, Const.ParamsNames.FEEDBACK_SESSION_NAME, "First feedback session" };
InstructorStudentRecordsAjaxPageAction a = getAction(submissionParams);
ShowPageResult r = getShowPageResult(a);
a = getAction(submissionParams);
r = getShowPageResult(a);
assertEquals(getPageResultDestination(Const.ViewURIs.INSTRUCTOR_STUDENT_RECORDS_AJAX, false, "idOfHelperOfCourse1"), r.getDestinationWithParams());
assertFalse(r.isError);
assertEquals("", r.getStatusMessage());
InstructorStudentRecordsAjaxPageData data = (InstructorStudentRecordsAjaxPageData) r.data;
assertEquals(0, data.getResultsTables().size());
}
Aggregations