Search in sources :

Example 6 with CourseAttributes

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

Example 7 with CourseAttributes

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

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

Example 9 with CourseAttributes

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

Example 10 with CourseAttributes

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

Aggregations

CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)106 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)48 Test (org.testng.annotations.Test)40 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)33 ArrayList (java.util.ArrayList)31 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)19 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)16 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)15 EmailWrapper (teammates.common.util.EmailWrapper)15 HashMap (java.util.HashMap)12 InvalidParametersException (teammates.common.exception.InvalidParametersException)10 EmailGenerator (teammates.logic.api.EmailGenerator)10 CourseDetailsBundle (teammates.common.datatransfer.CourseDetailsBundle)8 StatusMessage (teammates.common.util.StatusMessage)6 StudentProfileAttributes (teammates.common.datatransfer.attributes.StudentProfileAttributes)5 TeamDetailsBundle (teammates.common.datatransfer.TeamDetailsBundle)4 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)4 EntityAlreadyExistsException (teammates.common.exception.EntityAlreadyExistsException)4 InstructorCoursesPageData (teammates.ui.pagedata.InstructorCoursesPageData)4 InstructorFeedbackSessionsPageData (teammates.ui.pagedata.InstructorFeedbackSessionsPageData)4