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