Search in sources :

Example 1 with InstructorStudentRecordsAjaxPageAction

use of teammates.ui.controller.InstructorStudentRecordsAjaxPageAction 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 2 with InstructorStudentRecordsAjaxPageAction

use of teammates.ui.controller.InstructorStudentRecordsAjaxPageAction in project teammates by TEAMMATES.

the class InstructorStudentRecordsAjaxPageActionTest method testExecuteAndPostProcess.

@Override
@Test
public void testExecuteAndPostProcess() {
    InstructorAttributes instructor = typicalBundle.instructors.get("instructor3OfCourse1");
    StudentAttributes student = typicalBundle.students.get("student2InCourse1");
    String instructorId = instructor.googleId;
    gaeSimulation.loginAsInstructor(instructorId);
    ______TS("Typical case: specific session name");
    String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor.courseId, Const.ParamsNames.STUDENT_EMAIL, student.email, Const.ParamsNames.FEEDBACK_SESSION_NAME, "First feedback session" };
    InstructorStudentRecordsAjaxPageAction a = getAction(submissionParams);
    ShowPageResult r = getShowPageResult(a);
    assertEquals(getPageResultDestination(Const.ViewURIs.INSTRUCTOR_STUDENT_RECORDS_AJAX, false, "idOfInstructor3"), r.getDestinationWithParams());
    assertFalse(r.isError);
    assertEquals("", r.getStatusMessage());
    InstructorStudentRecordsAjaxPageData data = (InstructorStudentRecordsAjaxPageData) r.data;
    assertEquals(1, 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) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)2 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)2 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)2 InstructorStudentRecordsAjaxPageAction (teammates.ui.controller.InstructorStudentRecordsAjaxPageAction)2 ShowPageResult (teammates.ui.controller.ShowPageResult)2 InstructorStudentRecordsAjaxPageData (teammates.ui.pagedata.InstructorStudentRecordsAjaxPageData)2 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)1