use of teammates.ui.controller.ShowPageResult in project teammates by TEAMMATES.
the class AdminActivityLogPageActionTest method verifyActionResult.
private void verifyActionResult(int[][] expectedLogs, String... params) {
AdminActivityLogPageAction action = getAction(params);
ShowPageResult result = getShowPageResult(action);
AdminActivityLogPageData pageData = (AdminActivityLogPageData) result.data;
List<ActivityLogEntry> actualLogs = getLogsFromLogTemplateRows(pageData.getLogs());
verifyLogs(expectedLogs, actualLogs);
}
use of teammates.ui.controller.ShowPageResult in project teammates by TEAMMATES.
the class AdminEmailLogPageActionTest method verifyActionResult.
private void verifyActionResult(int[][] expectedLogs, String... params) {
AdminEmailLogPageAction action = getAction(params);
ShowPageResult result = getShowPageResult(action);
AdminEmailLogPageData pageData = (AdminEmailLogPageData) result.data;
List<EmailLogEntry> actualLogs = getLogsFromLogTemplateRows(pageData.getLogs());
verifyLogs(expectedLogs, actualLogs);
}
use of teammates.ui.controller.ShowPageResult in project teammates by TEAMMATES.
the class AdminHomePageActionTest method testExecuteAndPostProcess.
@Override
@Test
public void testExecuteAndPostProcess() {
______TS("Normal case: starting with a blank adminHome page");
final String adminUserId = "admin.user";
gaeSimulation.loginAsAdmin(adminUserId);
final AdminHomePageAction a = getAction();
final ShowPageResult result = getShowPageResult(a);
assertEquals(Const.ViewURIs.ADMIN_HOME, result.destination);
final AdminHomePageData startingPageData = (AdminHomePageData) result.data;
assertEquals("", startingPageData.instructorEmail);
assertEquals("", startingPageData.instructorInstitution);
assertEquals("", startingPageData.instructorName);
assertEquals("", result.getStatusMessage());
}
use of teammates.ui.controller.ShowPageResult 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());
}
use of teammates.ui.controller.ShowPageResult 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());
}
Aggregations