Search in sources :

Example 21 with ShowPageResult

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);
}
Also used : ShowPageResult(teammates.ui.controller.ShowPageResult) ActivityLogEntry(teammates.common.util.ActivityLogEntry) AdminActivityLogPageAction(teammates.ui.controller.AdminActivityLogPageAction) AdminActivityLogPageData(teammates.ui.pagedata.AdminActivityLogPageData)

Example 22 with ShowPageResult

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);
}
Also used : EmailLogEntry(teammates.common.util.EmailLogEntry) ShowPageResult(teammates.ui.controller.ShowPageResult) AdminEmailLogPageData(teammates.ui.pagedata.AdminEmailLogPageData) AdminEmailLogPageAction(teammates.ui.controller.AdminEmailLogPageAction)

Example 23 with ShowPageResult

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());
}
Also used : AdminHomePageAction(teammates.ui.controller.AdminHomePageAction) ShowPageResult(teammates.ui.controller.ShowPageResult) AdminHomePageData(teammates.ui.pagedata.AdminHomePageData) Test(org.testng.annotations.Test)

Example 24 with ShowPageResult

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());
}
Also used : InstructorCourseEnrollPageAction(teammates.ui.controller.InstructorCourseEnrollPageAction) ShowPageResult(teammates.ui.controller.ShowPageResult) InstructorCourseEnrollPageData(teammates.ui.pagedata.InstructorCourseEnrollPageData) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 25 with ShowPageResult

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());
}
Also used : InstructorCourseEnrollPageAction(teammates.ui.controller.InstructorCourseEnrollPageAction) ShowPageResult(teammates.ui.controller.ShowPageResult) InstructorCourseEnrollPageData(teammates.ui.pagedata.InstructorCourseEnrollPageData) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Aggregations

ShowPageResult (teammates.ui.controller.ShowPageResult)51 Test (org.testng.annotations.Test)42 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)31 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)15 RedirectResult (teammates.ui.controller.RedirectResult)10 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)8 UnauthorizedAccessException (teammates.common.exception.UnauthorizedAccessException)8 EntityNotFoundException (teammates.common.exception.EntityNotFoundException)5 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)4 NullPostParameterException (teammates.common.exception.NullPostParameterException)4 ArrayList (java.util.ArrayList)3 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)3 AdminActivityLogPageAction (teammates.ui.controller.AdminActivityLogPageAction)3 AdminEmailLogPageAction (teammates.ui.controller.AdminEmailLogPageAction)3 AjaxResult (teammates.ui.controller.AjaxResult)3 InstructorCourseEnrollPageAction (teammates.ui.controller.InstructorCourseEnrollPageAction)3 InstructorCourseEnrollPageData (teammates.ui.pagedata.InstructorCourseEnrollPageData)3 Instant (java.time.Instant)2 AdminEmailAttributes (teammates.common.datatransfer.attributes.AdminEmailAttributes)2 StudentProfileAttributes (teammates.common.datatransfer.attributes.StudentProfileAttributes)2