Search in sources :

Example 6 with AccountDetailInfo

use of com.google.gerrit.extensions.common.AccountDetailInfo in project gerrit by GerritCodeReview.

the class GetAccountDetailIT method searchForSecondaryEmailRequiresModifyAccountPermission.

@Test
public void searchForSecondaryEmailRequiresModifyAccountPermission() throws Exception {
    Account.Id id = accountOperations.newAccount().preferredEmail("preferred@email").addSecondaryEmail("secondary@email").create();
    RestResponse r = userRestSession.get("/accounts/secondary/detail/");
    r.assertStatus(404);
    // The admin has MODIFY_ACCOUNT permission and can see the user.
    r = adminRestSession.get("/accounts/secondary/detail/");
    r.assertStatus(200);
    AccountDetailInfo info = newGson().fromJson(r.getReader(), AccountDetailInfo.class);
    assertThat(info._accountId).isEqualTo(id.get());
}
Also used : Account(com.google.gerrit.entities.Account) AccountDetailInfo(com.google.gerrit.extensions.common.AccountDetailInfo) RestResponse(com.google.gerrit.acceptance.RestResponse) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 7 with AccountDetailInfo

use of com.google.gerrit.extensions.common.AccountDetailInfo in project gerrit by GerritCodeReview.

the class GetAccountDetailIT method getDetailForExtensionPointAccountTag.

@Test
public void getDetailForExtensionPointAccountTag() throws Exception {
    RestResponse r = userRestSession.get("/accounts/" + user.username() + "/detail/");
    AccountDetailInfo info = newGson().fromJson(r.getReader(), AccountDetailInfo.class);
    assertThat(info.tags).containsExactly("BASIC_USER");
}
Also used : AccountDetailInfo(com.google.gerrit.extensions.common.AccountDetailInfo) RestResponse(com.google.gerrit.acceptance.RestResponse) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 8 with AccountDetailInfo

use of com.google.gerrit.extensions.common.AccountDetailInfo in project gerrit by GerritCodeReview.

the class GetAccountDetailIT method getDetail.

@Test
public void getDetail() throws Exception {
    RestResponse r = adminRestSession.get("/accounts/" + admin.username() + "/detail/");
    AccountDetailInfo info = newGson().fromJson(r.getReader(), AccountDetailInfo.class);
    assertAccountInfo(admin, info);
    Account account = getAccount(admin.id());
    assertThat(info.registeredOn.getTime()).isEqualTo(account.registeredOn().toEpochMilli());
}
Also used : Account(com.google.gerrit.entities.Account) AccountDetailInfo(com.google.gerrit.extensions.common.AccountDetailInfo) RestResponse(com.google.gerrit.acceptance.RestResponse) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Aggregations

AccountDetailInfo (com.google.gerrit.extensions.common.AccountDetailInfo)8 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)7 Test (org.junit.Test)7 RestResponse (com.google.gerrit.acceptance.RestResponse)4 Account (com.google.gerrit.entities.Account)4 TestAccount (com.google.gerrit.acceptance.TestAccount)3 EmailInput (com.google.gerrit.extensions.api.accounts.EmailInput)3 PublicKeyStore.keyToString (com.google.gerrit.gpg.PublicKeyStore.keyToString)3 FillOptions (com.google.gerrit.server.account.AccountDirectory.FillOptions)1