use of com.google.gerrit.extensions.common.AccountInfo in project gerrit by GerritCodeReview.
the class AssigneeIT method assigneeAddedAsReviewer.
@Test
public void assigneeAddedAsReviewer() throws Exception {
ReviewerState state;
// CC) CC is stored as REVIEWER
if (notesMigration.readChanges()) {
state = ReviewerState.CC;
} else {
state = ReviewerState.REVIEWER;
}
PushOneCommit.Result r = createChange();
Iterable<AccountInfo> reviewers = getReviewers(r, state);
assertThat(reviewers).isNull();
assertThat(setAssignee(r, user.email)._accountId).isEqualTo(user.getId().get());
reviewers = getReviewers(r, state);
assertThat(reviewers).hasSize(1);
AccountInfo reviewer = Iterables.getFirst(reviewers, null);
assertThat(reviewer._accountId).isEqualTo(user.getId().get());
}
use of com.google.gerrit.extensions.common.AccountInfo in project gerrit by GerritCodeReview.
the class AccountIT method create.
@Test
public void create() throws Exception {
TestAccount foo = accounts.create("foo");
AccountInfo info = gApi.accounts().id(foo.id.get()).get();
assertThat(info.username).isEqualTo("foo");
if (SshMode.useSsh()) {
// account creation + adding SSH keys
accountIndexedCounter.assertReindexOf(foo, 2);
} else {
// account creation
accountIndexedCounter.assertReindexOf(foo, 1);
}
// check user branch
try (Repository repo = repoManager.openRepository(allUsers);
RevWalk rw = new RevWalk(repo)) {
Ref ref = repo.exactRef(RefNames.refsUsers(foo.getId()));
assertThat(ref).isNotNull();
RevCommit c = rw.parseCommit(ref.getObjectId());
long timestampDiffMs = Math.abs(c.getCommitTime() * 1000L - accountCache.get(foo.getId()).getAccount().getRegisteredOn().getTime());
assertThat(timestampDiffMs).isAtMost(ChangeRebuilderImpl.MAX_WINDOW_MS);
}
}
use of com.google.gerrit.extensions.common.AccountInfo in project gerrit by GerritCodeReview.
the class AccountIT method putStatus.
@Test
public void putStatus() throws Exception {
List<String> statuses = ImmutableList.of("OOO", "Busy");
AccountInfo info;
for (String status : statuses) {
gApi.accounts().self().setStatus(status);
admin.status = status;
info = gApi.accounts().self().get();
assertUser(info, admin);
accountIndexedCounter.assertReindexOf(admin);
}
}
use of com.google.gerrit.extensions.common.AccountInfo in project gerrit by GerritCodeReview.
the class AccountIT method suggestAccounts.
@Test
public void suggestAccounts() throws Exception {
String adminUsername = "admin";
List<AccountInfo> result = gApi.accounts().suggestAccounts().withQuery(adminUsername).get();
assertThat(result).hasSize(1);
assertThat(result.get(0).username).isEqualTo(adminUsername);
List<AccountInfo> resultShortcutApi = gApi.accounts().suggestAccounts(adminUsername).get();
assertThat(resultShortcutApi).hasSize(result.size());
List<AccountInfo> emptyResult = gApi.accounts().suggestAccounts("unknown").get();
assertThat(emptyResult).isEmpty();
accountIndexedCounter.assertNoReindex();
}
use of com.google.gerrit.extensions.common.AccountInfo in project gerrit by GerritCodeReview.
the class AccountIT method getByIntId.
@Test
public void getByIntId() throws Exception {
AccountInfo info = gApi.accounts().id("admin").get();
AccountInfo infoByIntId = gApi.accounts().id(info._accountId).get();
assertThat(info.name).isEqualTo(infoByIntId.name);
accountIndexedCounter.assertNoReindex();
}
Aggregations