use of teammates.common.datatransfer.attributes.StudentAttributes 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.StudentAttributes 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);
}
use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackRemindParticularStudentsActionTest method testAccessControl.
@Test
@Override
protected void testAccessControl() throws Exception {
FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
StudentAttributes studentNotSubmitFeedback = typicalBundle.students.get("student5InCourse1");
String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.SUBMISSION_REMIND_USERLIST, studentNotSubmitFeedback.getEmail() };
verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams);
verifyUnaccessibleWithoutModifySessionPrivilege(submissionParams);
}
use of teammates.common.datatransfer.attributes.StudentAttributes 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());
}
use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackPreviewAsStudentActionTest method testAccessControl.
@Override
@Test
protected void testAccessControl() throws Exception {
FeedbackSessionAttributes session = typicalBundle.feedbackSessions.get("session1InCourse1");
StudentAttributes student = typicalBundle.students.get("student1InCourse1");
String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), Const.ParamsNames.PREVIEWAS, student.email };
verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams);
}
Aggregations