use of com.google.gerrit.acceptance.AccountIndexedCounter in project gerrit by GerritCodeReview.
the class AccountIT method shouldAllowQueryByEmailForInactiveUser.
@Test
public void shouldAllowQueryByEmailForInactiveUser() throws Exception {
AccountIndexedCounter accountIndexedCounter = new AccountIndexedCounter();
try (Registration registration = extensionRegistry.newRegistration().add(accountIndexedCounter)) {
Account.Id activatableAccountId = accountOperations.newAccount().inactive().preferredEmail("foo@activatable.com").create();
accountIndexedCounter.assertReindexOf(activatableAccountId, 1);
}
gApi.changes().query("owner:foo@activatable.com").get();
}
use of com.google.gerrit.acceptance.AccountIndexedCounter in project gerrit by GerritCodeReview.
the class AccountIT method addOtherUsersGpgKey_Conflict.
@Test
public void addOtherUsersGpgKey_Conflict() throws Exception {
AccountIndexedCounter accountIndexedCounter = new AccountIndexedCounter();
try (Registration registration = extensionRegistry.newRegistration().add(accountIndexedCounter)) {
// Both users have a matching external ID for this key.
addExternalIdEmail(admin, "test5@example.com");
accountIndexedCounter.clear();
accountsUpdateProvider.get().update("Add External ID", user.id(), u -> u.addExternalId(externalIdFactory.create("foo", "myId", user.id())));
accountIndexedCounter.assertReindexOf(user);
TestKey key = validKeyWithSecondUserId();
addGpgKey(key.getPublicKeyArmored());
requestScopeOperations.setApiUser(user.id());
ResourceConflictException thrown = assertThrows(ResourceConflictException.class, () -> addGpgKey(user, key.getPublicKeyArmored()));
assertThat(thrown).hasMessageThat().contains("GPG key already associated with another account");
}
}
use of com.google.gerrit.acceptance.AccountIndexedCounter in project gerrit by GerritCodeReview.
the class AccountIT method createAnonymousCowardByAccountCreator.
@Test
public void createAnonymousCowardByAccountCreator() throws Exception {
AccountIndexedCounter accountIndexedCounter = new AccountIndexedCounter();
try (Registration registration = extensionRegistry.newRegistration().add(accountIndexedCounter)) {
TestAccount anonymousCoward = accountCreator.create();
accountIndexedCounter.assertReindexOf(anonymousCoward);
assertUserBranchWithoutAccountConfig(anonymousCoward.id());
}
}
use of com.google.gerrit.acceptance.AccountIndexedCounter in project gerrit by GerritCodeReview.
the class AccountIT method addReviewerToIgnoredChange.
@Test
public void addReviewerToIgnoredChange() throws Exception {
AccountIndexedCounter accountIndexedCounter = new AccountIndexedCounter();
try (Registration registration = extensionRegistry.newRegistration().add(accountIndexedCounter)) {
PushOneCommit.Result r = createChange();
requestScopeOperations.setApiUser(user.id());
gApi.changes().id(r.getChangeId()).ignore(true);
sender.clear();
requestScopeOperations.setApiUser(admin.id());
ReviewerInput in = new ReviewerInput();
in.reviewer = user.email();
gApi.changes().id(r.getChangeId()).addReviewer(in);
List<Message> messages = sender.getMessages();
assertThat(messages).hasSize(0);
}
}
use of com.google.gerrit.acceptance.AccountIndexedCounter in project gerrit by GerritCodeReview.
the class AccountIT method ignoreChange.
@Test
public void ignoreChange() throws Exception {
AccountIndexedCounter accountIndexedCounter = new AccountIndexedCounter();
try (Registration registration = extensionRegistry.newRegistration().add(accountIndexedCounter)) {
TestAccount user2 = accountCreator.user2();
accountIndexedCounter.clear();
PushOneCommit.Result r = createChange();
ReviewerInput in = new ReviewerInput();
in.reviewer = user.email();
gApi.changes().id(r.getChangeId()).addReviewer(in);
in = new ReviewerInput();
in.reviewer = user2.email();
gApi.changes().id(r.getChangeId()).addReviewer(in);
requestScopeOperations.setApiUser(user.id());
gApi.changes().id(r.getChangeId()).ignore(true);
sender.clear();
requestScopeOperations.setApiUser(admin.id());
gApi.changes().id(r.getChangeId()).abandon();
List<Message> messages = sender.getMessages();
assertThat(messages).hasSize(1);
assertThat(messages.get(0).rcpt()).containsExactly(user2.getNameEmail());
accountIndexedCounter.assertNoReindex();
}
}
Aggregations