Source:
protected void testAccessControl() throws Exception { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1"); ______TS("non-existent feedback session"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, "randomName for Session123", Const.ParamsNames.INTENT, Intent.FULL_DETAIL.toString(), }; loginAsInstructor(instructor1OfCourse1.googleId); verifyCannotAccess(submissionParams); ______TS("only instructors of the same course can access"); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.INTENT, Intent.FULL_DETAIL.toString(), }; verifyAccessibleForInstructorsOfTheSameCourse(submissionParams); verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams); ______TS("only students of the same course can access"); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.INTENT, Intent.STUDENT_RESULT.toString(), }; verifyAccessibleForStudentsOfTheSameCourse(submissionParams); verifyInaccessibleForStudentsOfOtherCourse(submissionParams); ______TS("only instructors of the same course can access"); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.INTENT, Intent.INSTRUCTOR_RESULT.toString(), }; verifyAccessibleForInstructorsOfTheSameCourse(submissionParams); verifyInaccessibleForInstructorsOfOtherCourses(submissionParams); verifyInaccessibleForStudents(submissionParams); }

Target:
protected void testAccessControl() throws Exception { InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1"); ______TS("non-existent feedback session"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, "randomName for Session123", Const.ParamsNames.INTENT, Intent.FULL_DETAIL.toString(), }; loginAsInstructor(instructor1OfCourse1.googleId); verifyCannotAccess(submissionParams); ______TS("only instructors of the same course can access full detail"); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.INTENT, Intent.FULL_DETAIL.toString(), }; verifyAccessibleForInstructorsOfTheSameCourse(submissionParams); verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams); ______TS("only students of the same course can access student result"); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.INTENT, Intent.STUDENT_RESULT.toString(), }; verifyAccessibleForStudentsOfTheSameCourse(submissionParams); verifyInaccessibleForStudentsOfOtherCourse(submissionParams); ______TS("only instructors of the same course can access instructor result"); submissionParams = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.INTENT, Intent.INSTRUCTOR_RESULT.toString(), }; verifyAccessibleForInstructorsOfTheSameCourse(submissionParams); verifyInaccessibleForInstructorsOfOtherCourses(submissionParams); verifyInaccessibleForStudents(submissionParams); }