Search in sources :

Example 31 with StudentAttributes

use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.

the class InstructorCourseStudentDetailsPageActionTest method testExecuteAndPostProcess.

@Override
@Test
public void testExecuteAndPostProcess() {
    InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
    StudentAttributes student1InCourse1 = typicalBundle.students.get("student1InCourse1");
    String instructorId = instructor1OfCourse1.googleId;
    gaeSimulation.loginAsInstructor(instructorId);
    ______TS("Invalid parameters");
    // no parameters
    verifyAssumptionFailure();
    // null student email
    String[] invalidParams = new String[] { Const.ParamsNames.COURSE_ID, instructor1OfCourse1.courseId };
    verifyAssumptionFailure(invalidParams);
    // null course id
    invalidParams = new String[] { Const.ParamsNames.STUDENT_EMAIL, student1InCourse1.email };
    verifyAssumptionFailure(invalidParams);
    ______TS("Typical case, view student detail");
    String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor1OfCourse1.courseId, Const.ParamsNames.STUDENT_EMAIL, student1InCourse1.email };
    InstructorCourseStudentDetailsPageAction a = getAction(submissionParams);
    ShowPageResult r = getShowPageResult(a);
    assertEquals(getPageResultDestination(Const.ViewURIs.INSTRUCTOR_COURSE_STUDENT_DETAILS, false, "idOfInstructor1OfCourse1"), r.getDestinationWithParams());
    assertFalse(r.isError);
    assertEquals("", r.getStatusMessage());
    InstructorCourseStudentDetailsPageData pageData = (InstructorCourseStudentDetailsPageData) r.data;
    assertEquals(instructorId, pageData.account.googleId);
    assertEquals(student1InCourse1.name, pageData.getStudentInfoTable().getName());
    assertEquals(student1InCourse1.email, pageData.getStudentInfoTable().getEmail());
    assertEquals(student1InCourse1.section, pageData.getStudentInfoTable().getSection());
    assertEquals(student1InCourse1.team, pageData.getStudentInfoTable().getTeam());
    assertEquals(student1InCourse1.comments, pageData.getStudentInfoTable().getComments());
    assertEquals(student1InCourse1.course, pageData.getStudentInfoTable().getCourse());
    String expectedLogMessage = "TEAMMATESLOG|||instructorCourseStudentDetailsPage|||instructorCourseStudentDetailsPage" + "|||true|||Instructor|||Instructor 1 of Course 1|||idOfInstructor1OfCourse1" + "|||instr1@course1.tmt|||instructorCourseStudentDetails Page Load<br>Viewing details for Student " + "<span class=\"bold\">student1InCourse1@gmail.tmt</span> in Course " + "<span class=\"bold\">[idOfTypicalCourse1]</span>" + "|||/page/instructorCourseStudentDetailsPage";
    AssertHelper.assertLogMessageEquals(expectedLogMessage, a.getLogMessage());
}
Also used : ShowPageResult(teammates.ui.controller.ShowPageResult) InstructorCourseStudentDetailsPageData(teammates.ui.pagedata.InstructorCourseStudentDetailsPageData) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) InstructorCourseStudentDetailsPageAction(teammates.ui.controller.InstructorCourseStudentDetailsPageAction) Test(org.testng.annotations.Test)

Example 32 with StudentAttributes

use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.

the class BaseActionTest method verifyUnaccessibleForStudents.

protected void verifyUnaccessibleForStudents(String[] submissionParams) {
    ______TS("students cannot access");
    InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
    StudentAttributes student1InCourse1 = typicalBundle.students.get("student1InCourse1");
    gaeSimulation.loginAsStudent(student1InCourse1.googleId);
    verifyCannotAccess(submissionParams);
    verifyCannotMasquerade(addUserIdToParams(instructor1OfCourse1.googleId, submissionParams));
}
Also used : StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 33 with StudentAttributes

use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.

the class BaseActionTest method addUnregStudentToCourse1.

protected static void addUnregStudentToCourse1() throws Exception {
    StudentsLogic.inst().deleteStudentCascade("idOfTypicalCourse1", "student6InCourse1@gmail.tmt");
    StudentAttributes student = StudentAttributes.builder("idOfTypicalCourse1", "unregistered student6 In Course1", "student6InCourse1@gmail.tmt").withTeam("Team Unregistered").withSection("Section 3").withComments("").build();
    StudentsLogic.inst().createStudentCascade(student);
}
Also used : StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes)

Example 34 with StudentAttributes

use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.

the class BaseActionTest method verifyAccessibleForStudents.

protected void verifyAccessibleForStudents(String[] submissionParams) {
    ______TS("students can access");
    InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
    StudentAttributes student1InCourse1 = typicalBundle.students.get("student1InCourse1");
    StudentAttributes otherStudent = typicalBundle.students.get("student1InCourse2");
    gaeSimulation.loginAsStudent(student1InCourse1.googleId);
    verifyCannotMasquerade(addUserIdToParams(instructor1OfCourse1.googleId, submissionParams));
    verifyCannotMasquerade(addUserIdToParams(otherStudent.googleId, submissionParams));
    verifyCanAccess(submissionParams);
}
Also used : StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 35 with StudentAttributes

use of teammates.common.datatransfer.attributes.StudentAttributes in project teammates by TEAMMATES.

the class BaseActionTest method addStudentAuthenticationInfo.

private String[] addStudentAuthenticationInfo(String[] params) {
    StudentAttributes unregStudent = StudentsLogic.inst().getStudentForEmail("idOfTypicalCourse1", "student6InCourse1@gmail.tmt");
    List<String> list = new ArrayList<>();
    list.add(Const.ParamsNames.REGKEY);
    list.add(StringHelper.encrypt(unregStudent.key));
    list.add(Const.ParamsNames.STUDENT_EMAIL);
    list.add(unregStudent.email);
    for (String s : params) {
        list.add(s);
    }
    return list.toArray(new String[0]);
}
Also used : ArrayList(java.util.ArrayList) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes)

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