use of com.google.gerrit.extensions.api.accounts.EmailInput in project gerrit by GerritCodeReview.
the class AccountIT method detailOfOtherAccountIncludeSecondaryEmailsWithModifyAccount.
@Test
public void detailOfOtherAccountIncludeSecondaryEmailsWithModifyAccount() throws Exception {
String email = "preferred@example.com";
TestAccount foo = accountCreator.create(name("foo"), email, "Foo", null);
String secondaryEmail = "secondary@example.com";
EmailInput input = newEmailInput(secondaryEmail);
gApi.accounts().id(foo.id().get()).addEmail(input);
AccountDetailInfo detail = gApi.accounts().id(foo.id().get()).detail();
assertThat(detail.secondaryEmails).containsExactly(secondaryEmail);
}
use of com.google.gerrit.extensions.api.accounts.EmailInput in project gerrit by GerritCodeReview.
the class AccountIT method addEmail.
@Test
public void addEmail() throws Exception {
AccountIndexedCounter accountIndexedCounter = new AccountIndexedCounter();
try (Registration registration = extensionRegistry.newRegistration().add(accountIndexedCounter)) {
List<String> emails = ImmutableList.of("new.email@example.com", "new.email@example.systems");
Set<String> currentEmails = getEmails();
for (String email : emails) {
assertThat(currentEmails).doesNotContain(email);
EmailInput input = newEmailInput(email);
gApi.accounts().self().addEmail(input);
accountIndexedCounter.assertReindexOf(admin);
}
requestScopeOperations.resetCurrentApiUser();
assertThat(getEmails()).containsAtLeastElementsIn(emails);
}
}
use of com.google.gerrit.extensions.api.accounts.EmailInput in project gerrit by GerritCodeReview.
the class AccountIT method detailOfOtherAccountDoesntIncludeSecondaryEmailsWithoutModifyAccount.
@Test
public void detailOfOtherAccountDoesntIncludeSecondaryEmailsWithoutModifyAccount() throws Exception {
String email = "preferred@example.com";
TestAccount foo = accountCreator.create(name("foo"), email, "Foo", null);
String secondaryEmail = "secondary@example.com";
EmailInput input = newEmailInput(secondaryEmail);
gApi.accounts().id(foo.id().get()).addEmail(input);
requestScopeOperations.setApiUser(user.id());
AccountDetailInfo detail = gApi.accounts().id(foo.id().get()).detail();
assertThat(detail.secondaryEmails).isNull();
}
use of com.google.gerrit.extensions.api.accounts.EmailInput in project gerrit by GerritCodeReview.
the class SuggestReviewersIT method createAccountWithSecondaryEmail.
private TestAccount createAccountWithSecondaryEmail(String name, String secondaryEmail) throws Exception {
TestAccount foo = accountCreator.create(name(name), "foo.primary@example.com", "Foo", null);
EmailInput input = new EmailInput();
input.email = secondaryEmail;
input.noConfirmation = true;
gApi.accounts().id(foo.id().get()).addEmail(input);
return foo;
}
Aggregations