Search in sources :

Example 1 with ImageResult

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

the class StudentProfilePictureActionTest method testActionWithBlobKeySuccess.

private void testActionWithBlobKeySuccess() {
    ______TS("Typical case: using blobkey");
    gaeSimulation.loginAsStudent(account.googleId);
    String[] submissionParams = new String[] { Const.ParamsNames.BLOB_KEY, account.studentProfile.pictureKey };
    StudentProfilePictureAction action = getAction(submissionParams);
    ImageResult result = getImageResult(action);
    assertFalse(result.isError);
    assertEquals("", result.getStatusMessage());
    assertEquals(account.studentProfile.pictureKey, result.blobKey);
    verifyLogMessageForActionWithBlobKey(false, action.getLogMessage());
}
Also used : ImageResult(teammates.ui.controller.ImageResult) StudentProfilePictureAction(teammates.ui.controller.StudentProfilePictureAction)

Example 2 with ImageResult

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

the class StudentProfilePictureActionTest method testActionForStudentWithEmptyGoogleId.

private void testActionForStudentWithEmptyGoogleId() {
    ______TS("Failure case: no profile available (unreg student)");
    StudentAttributes student = typicalBundle.students.get("student2InUnregisteredCourse");
    assertTrue(student.googleId.isEmpty());
    String[] submissionParams = new String[] { Const.ParamsNames.STUDENT_EMAIL, StringHelper.encrypt(student.email), Const.ParamsNames.COURSE_ID, StringHelper.encrypt(student.course) };
    StudentProfilePictureAction action = getAction(submissionParams);
    ImageResult result = getImageResult(action);
    assertEquals("", result.blobKey);
}
Also used : ImageResult(teammates.ui.controller.ImageResult) StudentProfilePictureAction(teammates.ui.controller.StudentProfilePictureAction) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes)

Example 3 with ImageResult

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

the class StudentProfilePictureActionTest method testActionWithBlobKeySuccessMasquerade.

private void testActionWithBlobKeySuccessMasquerade() {
    ______TS("Typical case: masquerade mode");
    gaeSimulation.loginAsAdmin("admin.user");
    String[] submissionParams = new String[] { Const.ParamsNames.USER_ID, account.googleId, Const.ParamsNames.BLOB_KEY, account.studentProfile.pictureKey };
    StudentProfilePictureAction action = getAction(addUserIdToParams(account.googleId, submissionParams));
    ImageResult result = getImageResult(action);
    assertFalse(result.isError);
    assertEquals("", result.getStatusMessage());
    verifyLogMessageForActionWithBlobKey(true, action.getLogMessage());
}
Also used : ImageResult(teammates.ui.controller.ImageResult) StudentProfilePictureAction(teammates.ui.controller.StudentProfilePictureAction)

Example 4 with ImageResult

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

the class StudentProfilePictureActionTest method testActionWithEmailAndCourseSuccessTypical.

private void testActionWithEmailAndCourseSuccessTypical(AccountAttributes instructor) {
    ______TS("Typical case: using email and course");
    String[] submissionParams = new String[] { Const.ParamsNames.STUDENT_EMAIL, StringHelper.encrypt(student.email), Const.ParamsNames.COURSE_ID, StringHelper.encrypt(student.course) };
    StudentProfilePictureAction action = getAction(submissionParams);
    ImageResult result = getImageResult(action);
    assertFalse(result.isError);
    assertEquals("", result.getStatusMessage());
    assertEquals("asdf34&hfn3!@", result.blobKey);
    verifyLogMessageForActionWithEmailAndCourse(instructor, false, action.getLogMessage());
}
Also used : ImageResult(teammates.ui.controller.ImageResult) StudentProfilePictureAction(teammates.ui.controller.StudentProfilePictureAction)

Aggregations

ImageResult (teammates.ui.controller.ImageResult)4 StudentProfilePictureAction (teammates.ui.controller.StudentProfilePictureAction)4 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)1