Search in sources :

Example 6 with InstructorCourseEnrollPageData

use of teammates.ui.pagedata.InstructorCourseEnrollPageData in project teammates by TEAMMATES.

the class InstructorCourseEnrollPageDataTest method testAll.

@Test
public void testAll() {
    ______TS("test typical case");
    AccountAttributes account = dataBundle.accounts.get("instructor1OfCourse1");
    String courseId = "CourseId";
    String enroll = "Section | Team | Name | Email | Comments\n" + "Tut Group 1 | Team 1 | Tom Jacobs | tom@email.com\n" + "Tut Group 1 | Team 1 | Jean Wong | jean@email.com | Exchange Student\n" + "Tut Group 1 | Team 2 | Jack Wayne | jack@email.com\n" + "Tut Group 2 | Team 3 | Thora Parker | thora@email.com";
    InstructorCourseEnrollPageData pageData = new InstructorCourseEnrollPageData(account, dummySessionToken, courseId, enroll);
    assertNotNull(pageData.getCourseId());
    assertEquals(courseId, pageData.getCourseId());
    assertNotNull(pageData.getEnrollStudents());
    assertEquals(enroll, pageData.getEnrollStudents());
    assertNotNull(pageData.account);
    assertEquals(account.googleId, pageData.account.googleId);
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) InstructorCourseEnrollPageData(teammates.ui.pagedata.InstructorCourseEnrollPageData) Test(org.testng.annotations.Test)

Example 7 with InstructorCourseEnrollPageData

use of teammates.ui.pagedata.InstructorCourseEnrollPageData 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

InstructorCourseEnrollPageData (teammates.ui.pagedata.InstructorCourseEnrollPageData)7 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)6 ShowPageResult (teammates.ui.controller.ShowPageResult)4 InstructorCourseEnrollPageAction (teammates.ui.controller.InstructorCourseEnrollPageAction)3 Test (org.testng.annotations.Test)2 InstructorCourseEnrollResultPageData (teammates.ui.pagedata.InstructorCourseEnrollResultPageData)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)1 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)1 EnrollException (teammates.common.exception.EnrollException)1 EntityAlreadyExistsException (teammates.common.exception.EntityAlreadyExistsException)1 InvalidParametersException (teammates.common.exception.InvalidParametersException)1 StatusMessage (teammates.common.util.StatusMessage)1 TaskWrapper (teammates.common.util.TaskWrapper)1 InstructorCourseEnrollSaveAction (teammates.ui.controller.InstructorCourseEnrollSaveAction)1