use of com.google.gerrit.acceptance.TestAccount in project gerrit by GerritCodeReview.
the class ChangeReviewersIT method notifyDetailsWorkOnPostReviewers.
@Test
public void notifyDetailsWorkOnPostReviewers() throws Exception {
PushOneCommit.Result r = createChange();
TestAccount userToNotify = createAccounts(1, "notify-details-post-reviewers").get(0);
AddReviewerInput addReviewer = new AddReviewerInput();
addReviewer.reviewer = user.email;
addReviewer.notify = NotifyHandling.NONE;
addReviewer.notifyDetails = ImmutableMap.of(RecipientType.TO, new NotifyInfo(ImmutableList.of(userToNotify.email)));
sender.clear();
gApi.changes().id(r.getChangeId()).addReviewer(addReviewer);
assertThat(sender.getMessages()).hasSize(1);
assertThat(sender.getMessages().get(0).rcpt()).containsExactly(userToNotify.emailAddress);
}
use of com.google.gerrit.acceptance.TestAccount in project gerrit by GerritCodeReview.
the class RevisionIT method cherryPickNotify.
@Test
public void cherryPickNotify() throws Exception {
createBranch(new NameKey(project, "branch-1"));
createBranch(new NameKey(project, "branch-2"));
createBranch(new NameKey(project, "branch-3"));
// Creates a change for 'admin'.
PushOneCommit.Result result = createChange();
String changeId = project.get() + "~master~" + result.getChangeId();
// 'user' cherry-picks the change to a new branch, the source change's author/committer('admin')
// will be added as a reviewer of the newly created change.
setApiUser(user);
CherryPickInput input = new CherryPickInput();
input.message = "it goes to a new branch";
// Enable the notification. 'admin' as a reviewer should be notified.
input.destination = "branch-1";
input.notify = NotifyHandling.ALL;
sender.clear();
gApi.changes().id(changeId).current().cherryPick(input);
assertNotifyCc(admin);
// Disable the notification. 'admin' as a reviewer should not be notified any more.
input.destination = "branch-2";
input.notify = NotifyHandling.NONE;
sender.clear();
gApi.changes().id(changeId).current().cherryPick(input);
assertThat(sender.getMessages()).hasSize(0);
// Disable the notification. The user provided in the 'notifyDetails' should still be notified.
TestAccount userToNotify = accounts.user2();
input.destination = "branch-3";
input.notify = NotifyHandling.NONE;
input.notifyDetails = ImmutableMap.of(RecipientType.TO, new NotifyInfo(ImmutableList.of(userToNotify.email)));
sender.clear();
gApi.changes().id(changeId).current().cherryPick(input);
assertNotifyTo(userToNotify);
}
use of com.google.gerrit.acceptance.TestAccount in project gerrit by GerritCodeReview.
the class GroupsIT method reindexPermissions.
// reindex is tested by {@link AbstractQueryGroupsTest#reindex}
@Test
public void reindexPermissions() throws Exception {
TestAccount groupOwner = accounts.user2();
GroupInput in = new GroupInput();
in.name = name("group");
in.members = Collections.singleton(groupOwner).stream().map(u -> u.id.toString()).collect(toList());
in.visibleToAll = true;
GroupInfo group = gApi.groups().create(in).get();
// admin can reindex any group
setApiUser(admin);
gApi.groups().id(group.id).index();
// group owner can reindex own group (group is owned by itself)
setApiUser(groupOwner);
gApi.groups().id(group.id).index();
// user cannot reindex any group
setApiUser(user);
exception.expect(AuthException.class);
exception.expectMessage("not allowed to index group");
gApi.groups().id(group.id).index();
}
use of com.google.gerrit.acceptance.TestAccount in project gerrit by GerritCodeReview.
the class GroupsIT method addMembersWithAtSign.
@Test
public void addMembersWithAtSign() throws Exception {
String g = createGroup("users");
TestAccount u10 = accounts.create("u10", "u10@example.com", "Full Name 10");
TestAccount u11_at = accounts.create("u11@something", "u11@example.com", "Full Name 11 With At");
accounts.create("u11", "u11.another@example.com", "Full Name 11 Without At");
gApi.groups().id(g).addMembers(u10.username, u11_at.username);
assertMembers(g, u10, u11_at);
}
use of com.google.gerrit.acceptance.TestAccount in project gerrit by GerritCodeReview.
the class SuggestReviewersIT method defaultReviewerSuggestionOnFirstChange.
@Test
public void defaultReviewerSuggestionOnFirstChange() throws Exception {
TestAccount user1 = user("customuser1", "User1");
setApiUser(user1);
List<SuggestedReviewerInfo> reviewers = suggestReviewers(createChange().getChangeId(), "", 4);
assertThat(reviewers).isEmpty();
}
Aggregations