use of teammates.common.datatransfer.attributes.StudentProfileAttributes in project teammates by TEAMMATES.
the class ProfilesDbTest method testDeletePictureSuccess.
private void testDeletePictureSuccess(AccountAttributes a) throws EntityDoesNotExistException {
______TS("delete picture");
profilesDb.deleteStudentProfilePicture(a.googleId);
StudentProfileAttributes updatedProfile = profilesDb.getStudentProfile(a.studentProfile.googleId);
assertFalse(doesFileExistInGcs(new BlobKey(updatedProfile.pictureKey)));
assertEquals("", updatedProfile.pictureKey);
}
use of teammates.common.datatransfer.attributes.StudentProfileAttributes in project teammates by TEAMMATES.
the class ProfilesDbTest method testUpdateProfileSuccessInitiallyEmptyPictureKey.
private void testUpdateProfileSuccessInitiallyEmptyPictureKey(AccountAttributes a) throws Exception, EntityDoesNotExistException {
______TS("success case: add picture (initially empty)");
a.studentProfile.pictureKey = uploadDefaultPictureForProfile(a.googleId);
profilesDb.updateStudentProfile(a.studentProfile);
StudentProfileAttributes updatedProfile = profilesDb.getStudentProfile(a.studentProfile.googleId);
assertEquals(a.studentProfile.pictureKey, updatedProfile.pictureKey);
}
use of teammates.common.datatransfer.attributes.StudentProfileAttributes in project teammates by TEAMMATES.
the class StudentCourseDetailsPageActionTest method getProfileAttributesFrom.
private StudentProfileAttributes getProfileAttributesFrom(String googleId, String[] submissionParams) {
StudentProfileAttributes spa = StudentProfileAttributes.builder(googleId).build();
spa.shortName = StringHelper.trimIfNotNull(submissionParams[1]);
spa.email = StringHelper.trimIfNotNull(submissionParams[3]);
spa.institute = StringHelper.trimIfNotNull(submissionParams[5]);
spa.nationality = StringHelper.trimIfNotNull(submissionParams[7]);
spa.gender = StringHelper.trimIfNotNull(submissionParams[9]);
spa.moreInfo = StringHelper.trimIfNotNull(submissionParams[11]);
spa.modifiedDate = null;
return spa;
}
use of teammates.common.datatransfer.attributes.StudentProfileAttributes in project teammates by TEAMMATES.
the class StudentCourseDetailsPageActionTest method testTeamMemberDetailsOnViewTeamPage.
@Test
public void testTeamMemberDetailsOnViewTeamPage() {
AccountAttributes student = typicalBundle.accounts.get("student1InCourse1");
String[] submissionParams = createValidParamsForProfile();
StudentProfileAttributes expectedProfile = getProfileAttributesFrom(student.googleId, submissionParams);
gaeSimulation.loginAsStudent(student.googleId);
// adding profile picture for student1InCourse1
StudentProfileEditSaveAction action = getStudentProfileEditSaveAction(submissionParams);
RedirectResult result = getRedirectResult(action);
expectedProfile.googleId = student.googleId;
assertFalse(result.isError);
StudentAttributes student1 = typicalBundle.students.get("student1InCourse1");
gaeSimulation.logoutUser();
gaeSimulation.loginAsStudent(typicalBundle.accounts.get("student2InCourse1").googleId);
String[] submissionParam = new String[] { Const.ParamsNames.COURSE_ID, student1.course };
StudentCourseDetailsPageAction pageAction = getAction(submissionParam);
ShowPageResult pageResult = getShowPageResult(pageAction);
StudentCourseDetailsPageData pageData = (StudentCourseDetailsPageData) pageResult.data;
List<StudentAttributes> actualStudentsList = pageData.getStudentCourseDetailsPanel().getTeammates();
boolean isStudentDisplayedOnViewTeam = false;
for (StudentAttributes stud : actualStudentsList) {
if (student1.email.equals(stud.email) && student1.name.equals(stud.name) && student1.getPublicProfilePictureUrl().equals(stud.getPublicProfilePictureUrl())) {
isStudentDisplayedOnViewTeam = true;
}
}
assertTrue(isStudentDisplayedOnViewTeam);
}
use of teammates.common.datatransfer.attributes.StudentProfileAttributes in project teammates by TEAMMATES.
the class StudentProfileEditSaveActionTest method testActionSuccess.
private void testActionSuccess(AccountAttributes student, String caseDescription) {
String[] submissionParams = createValidParamsForProfile();
StudentProfileAttributes expectedProfile = getProfileAttributesFrom(student.googleId, submissionParams);
gaeSimulation.loginAsStudent(student.googleId);
______TS(caseDescription);
StudentProfileEditSaveAction action = getAction(submissionParams);
RedirectResult result = getRedirectResult(action);
expectedProfile.googleId = student.googleId;
assertFalse(result.isError);
AssertHelper.assertContains(getPageResultDestination(Const.ActionURIs.STUDENT_PROFILE_PAGE, false, student.googleId), result.getDestinationWithParams());
assertEquals(Const.StatusMessages.STUDENT_PROFILE_EDITED, result.getStatusMessage());
verifyLogMessage(student, action, expectedProfile, false);
}
Aggregations