Search in sources :

Example 21 with StudentAttributes

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());
}
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)

Example 22 with StudentAttributes

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);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) InstructorFeedbackRemindParticularStudentsAction(teammates.ui.controller.InstructorFeedbackRemindParticularStudentsAction) RedirectResult(teammates.ui.controller.RedirectResult) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) Test(org.testng.annotations.Test)

Example 23 with StudentAttributes

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);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) Test(org.testng.annotations.Test)

Example 24 with StudentAttributes

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());
}
Also used : InstructorStudentRecordsAjaxPageData(teammates.ui.pagedata.InstructorStudentRecordsAjaxPageData) ShowPageResult(teammates.ui.controller.ShowPageResult) InstructorStudentRecordsAjaxPageAction(teammates.ui.controller.InstructorStudentRecordsAjaxPageAction) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes) Test(org.testng.annotations.Test)

Example 25 with StudentAttributes

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);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) Test(org.testng.annotations.Test)

Aggregations

StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)241 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)85 Test (org.testng.annotations.Test)80 ArrayList (java.util.ArrayList)55 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)33 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)33 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)30 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)27 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)22 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)17 ShowPageResult (teammates.ui.controller.ShowPageResult)15 HashMap (java.util.HashMap)14 TeamDetailsBundle (teammates.common.datatransfer.TeamDetailsBundle)14 InvalidParametersException (teammates.common.exception.InvalidParametersException)14 EmailWrapper (teammates.common.util.EmailWrapper)13 RedirectResult (teammates.ui.controller.RedirectResult)12 List (java.util.List)11 StatusMessage (teammates.common.util.StatusMessage)10 HashSet (java.util.HashSet)9 StudentEnrollDetails (teammates.common.datatransfer.StudentEnrollDetails)9