use of teammates.ui.controller.StudentProfilePictureAction 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());
}
use of teammates.ui.controller.StudentProfilePictureAction in project teammates by TEAMMATES.
the class StudentProfilePictureActionTest method testActionWithEmailAndCourseNoStudent.
private void testActionWithEmailAndCourseNoStudent() {
______TS("Failure case: student does not exist");
String[] submissionParams = new String[] { Const.ParamsNames.STUDENT_EMAIL, StringHelper.encrypt("random-email"), Const.ParamsNames.COURSE_ID, StringHelper.encrypt(student.course) };
StudentProfilePictureAction action = getAction(submissionParams);
try {
action.executeAndPostProcess();
signalFailureToDetectException("Entity Does not exist");
} catch (EntityNotFoundException enfe) {
assertEquals("student with " + student.course + "/random-email", enfe.getMessage());
}
}
use of teammates.ui.controller.StudentProfilePictureAction 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);
}
use of teammates.ui.controller.StudentProfilePictureAction 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());
}
use of teammates.ui.controller.StudentProfilePictureAction 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());
}
Aggregations