Search in sources :

Example 41 with AccountAttributes

use of teammates.common.datatransfer.attributes.AccountAttributes in project teammates by TEAMMATES.

the class ProfilesDbTest method testUpdateStudentProfile.

@Test
public void testUpdateStudentProfile() throws Exception {
    AccountAttributes a = createNewAccount();
    // failure cases
    testUpdateProfileWithNullParameter();
    testUpdateProfileWithInvalidParameters();
    testUpdatingNonExistentProfile(a);
    // success cases
    testUpdateProfileSuccessWithNoPictureKey(a);
    testUpdateProfileSuccessInitiallyEmptyPictureKey(a);
    testUpdateProfileSuccessNoChangesToProfile(a);
    testUpdateProfileSuccessWithSamePictureKey(a);
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) Test(org.testng.annotations.Test)

Example 42 with AccountAttributes

use of teammates.common.datatransfer.attributes.AccountAttributes in project teammates by TEAMMATES.

the class ProfilesDbTest method testUpdateStudentProfilePicture.

@Test
public void testUpdateStudentProfilePicture() throws Exception {
    AccountAttributes a = createNewAccount();
    // failure test cases
    testUpdateProfilePictureWithNullParameters();
    testUpdateProfilePictureWithEmptyParameters(a);
    testUpdateProfilePictureOnNonExistentProfile();
    // success test cases
    testUpdateProfilePictureSuccessInitiallyEmpty(a);
    testUpdateProfilePictureSuccessSamePictureKey(a);
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) Test(org.testng.annotations.Test)

Example 43 with AccountAttributes

use of teammates.common.datatransfer.attributes.AccountAttributes in project teammates by TEAMMATES.

the class BackDoorTest method testCreateAccount.

@Test
public void testCreateAccount() {
    AccountAttributes newAccount = dataBundle.accounts.get("instructor1OfCourse1");
    // Make sure not already inside
    BackDoor.deleteAccount(newAccount.googleId);
    verifyAbsentInDatastore(newAccount);
    // Perform creation
    BackDoor.createAccount(newAccount);
    verifyPresentInDatastore(newAccount);
    // Clean up
    BackDoor.deleteAccount(newAccount.googleId);
    verifyAbsentInDatastore(newAccount);
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) Test(org.testng.annotations.Test)

Example 44 with AccountAttributes

use of teammates.common.datatransfer.attributes.AccountAttributes in project teammates by TEAMMATES.

the class AdminAccountManagementPageData method createAccountTable.

private List<AdminAccountManagementAccountTableRow> createAccountTable(Map<String, AccountAttributes> instructorAccountsTable, Map<String, ArrayList<InstructorAttributes>> instructorCoursesTable) {
    List<AdminAccountManagementAccountTableRow> table = new ArrayList<>();
    for (Map.Entry<String, AccountAttributes> entry : instructorAccountsTable.entrySet()) {
        String key = entry.getKey();
        AccountAttributes acc = entry.getValue();
        if (isTestingAccount(acc) && !isToShowAll) {
            continue;
        }
        ArrayList<InstructorAttributes> coursesList = instructorCoursesTable.get(key);
        AdminAccountManagementAccountTableRow row = new AdminAccountManagementAccountTableRow(acc, coursesList, getSessionToken());
        table.add(row);
    }
    return table;
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) ArrayList(java.util.ArrayList) Map(java.util.Map) AdminAccountManagementAccountTableRow(teammates.ui.template.AdminAccountManagementAccountTableRow) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 45 with AccountAttributes

use of teammates.common.datatransfer.attributes.AccountAttributes in project teammates by TEAMMATES.

the class Action method authenticateAndGetActualUser.

protected AccountAttributes authenticateAndGetActualUser(UserType currentUser) {
    if (doesUserNeedToLogin(currentUser)) {
        return null;
    }
    AccountAttributes loggedInUser = null;
    String email = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL);
    String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
    if (currentUser == null) {
        Assumption.assertPostParamNotNull(Const.ParamsNames.REGKEY, regkey);
        loggedInUser = authenticateNotLoggedInUser(email, courseId);
    } else {
        loggedInUser = logic.getAccount(currentUser.id);
        if (doesRegkeyMatchLoggedInUserGoogleId(currentUser.id)) {
            loggedInUser = createDummyAccountIfUserIsUnregistered(currentUser, loggedInUser);
        }
    }
    return loggedInUser;
}
Also used : AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes)

Aggregations

AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)84 Test (org.testng.annotations.Test)53 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)28 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)16 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)15 ArrayList (java.util.ArrayList)13 StudentProfileAttributes (teammates.common.datatransfer.attributes.StudentProfileAttributes)11 HashMap (java.util.HashMap)7 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)6 InvalidParametersException (teammates.common.exception.InvalidParametersException)6 UnauthorizedAccessException (teammates.common.exception.UnauthorizedAccessException)5 CourseDetailsBundle (teammates.common.datatransfer.CourseDetailsBundle)4 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)4 EmailWrapper (teammates.common.util.EmailWrapper)4 RedirectResult (teammates.ui.controller.RedirectResult)4 List (java.util.List)3 EmailGenerator (teammates.logic.api.EmailGenerator)3 AccountsDb (teammates.storage.api.AccountsDb)3 Account (teammates.storage.entity.Account)3 ShowPageResult (teammates.ui.controller.ShowPageResult)3