Search in sources :

Example 1 with InstructorCourseEnrollPageAction

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

the class InstructorCourseEnrollPageActionTest method visitEnrollPage_forCourseWithResponses_hasWarningMessage.

private void visitEnrollPage_forCourseWithResponses_hasWarningMessage() {
    ______TS("Typical case 2: open the enroll page of a course with existing feedback responses");
    InstructorAttributes instructor = typicalBundle.instructors.get("instructor1OfCourse1");
    gaeSimulation.loginAsInstructor(instructor.getGoogleId());
    String courseId = instructor.getCourseId();
    String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, courseId };
    InstructorCourseEnrollPageAction enrollPageAction = getAction(submissionParams);
    ShowPageResult pageResult = getShowPageResult(enrollPageAction);
    assertEquals(getPageResultDestination(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL, false, "idOfInstructor1OfCourse1"), pageResult.getDestinationWithParams());
    assertFalse(pageResult.isError);
    assertEquals(Const.StatusMessages.COURSE_ENROLL_POSSIBLE_DATA_LOSS, pageResult.getStatusMessage());
    InstructorCourseEnrollPageData pageData = (InstructorCourseEnrollPageData) pageResult.data;
    assertEquals(courseId, pageData.getCourseId());
    assertNull(pageData.getEnrollStudents());
    String expectedLogSegment = String.format(Const.StatusMessages.ADMIN_LOG_INSTRUCTOR_COURSE_ENROLL_PAGE_LOAD, courseId);
    AssertHelper.assertContains(expectedLogSegment, enrollPageAction.getLogMessage());
}
Also used : InstructorCourseEnrollPageAction(teammates.ui.controller.InstructorCourseEnrollPageAction) ShowPageResult(teammates.ui.controller.ShowPageResult) InstructorCourseEnrollPageData(teammates.ui.pagedata.InstructorCourseEnrollPageData) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 2 with InstructorCourseEnrollPageAction

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

the class InstructorCourseEnrollPageActionTest method visitEnrollPage_forCourseWithoutResponses_noWarningMessage.

private void visitEnrollPage_forCourseWithoutResponses_noWarningMessage() {
    ______TS("Typical case 1: open the enroll page of a course without existing feedback responses");
    InstructorAttributes instructor = typicalBundle.instructors.get("instructor4");
    gaeSimulation.loginAsInstructor(instructor.getGoogleId());
    String courseId = instructor.getCourseId();
    String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, courseId };
    InstructorCourseEnrollPageAction enrollPageAction = getAction(submissionParams);
    ShowPageResult pageResult = getShowPageResult(enrollPageAction);
    assertEquals(getPageResultDestination(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL, false, "idOfInstructor4"), pageResult.getDestinationWithParams());
    assertFalse(pageResult.isError);
    assertEquals("", pageResult.getStatusMessage());
    InstructorCourseEnrollPageData pageData = (InstructorCourseEnrollPageData) pageResult.data;
    assertEquals(courseId, pageData.getCourseId());
    assertNull(pageData.getEnrollStudents());
    String expectedLogSegment = String.format(Const.StatusMessages.ADMIN_LOG_INSTRUCTOR_COURSE_ENROLL_PAGE_LOAD, courseId);
    AssertHelper.assertContains(expectedLogSegment, enrollPageAction.getLogMessage());
}
Also used : InstructorCourseEnrollPageAction(teammates.ui.controller.InstructorCourseEnrollPageAction) ShowPageResult(teammates.ui.controller.ShowPageResult) InstructorCourseEnrollPageData(teammates.ui.pagedata.InstructorCourseEnrollPageData) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 3 with InstructorCourseEnrollPageAction

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

the class InstructorCourseEnrollPageActionTest method visitEnrollPage_inMasqueradeMode.

private void visitEnrollPage_inMasqueradeMode() {
    ______TS("Masquerade mode");
    gaeSimulation.loginAsAdmin("admin.user");
    InstructorAttributes instructorToMasquerade = typicalBundle.instructors.get("instructor4");
    String instructorId = instructorToMasquerade.googleId;
    String courseId = instructorToMasquerade.courseId;
    String[] submissionParams = new String[] { Const.ParamsNames.USER_ID, instructorId, Const.ParamsNames.COURSE_ID, courseId };
    InstructorCourseEnrollPageAction enrollPageAction = getAction(submissionParams);
    ShowPageResult pageResult = getShowPageResult(enrollPageAction);
    assertEquals(getPageResultDestination(Const.ViewURIs.INSTRUCTOR_COURSE_ENROLL, false, "idOfInstructor4"), pageResult.getDestinationWithParams());
    assertFalse(pageResult.isError);
    assertEquals("", pageResult.getStatusMessage());
    InstructorCourseEnrollPageData pageData = (InstructorCourseEnrollPageData) pageResult.data;
    assertEquals(courseId, pageData.getCourseId());
    assertNull(pageData.getEnrollStudents());
    String expectedLogSegment = String.format(Const.StatusMessages.ADMIN_LOG_INSTRUCTOR_COURSE_ENROLL_PAGE_LOAD, courseId);
    AssertHelper.assertContains(expectedLogSegment, enrollPageAction.getLogMessage());
}
Also used : InstructorCourseEnrollPageAction(teammates.ui.controller.InstructorCourseEnrollPageAction) ShowPageResult(teammates.ui.controller.ShowPageResult) InstructorCourseEnrollPageData(teammates.ui.pagedata.InstructorCourseEnrollPageData) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Aggregations

InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)3 InstructorCourseEnrollPageAction (teammates.ui.controller.InstructorCourseEnrollPageAction)3 ShowPageResult (teammates.ui.controller.ShowPageResult)3 InstructorCourseEnrollPageData (teammates.ui.pagedata.InstructorCourseEnrollPageData)3