Use AccountOperations to create/update accounts in more tests
MailProcessorIT.parseAndPersistMessageFromInactiveAccount doesn't need to reset the account status because this is already handled by ProjectResetter. Change-Id: Idf7bb86e0de06e3b850d1c6e6a5a64ca9a23fcc5 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -1692,7 +1692,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
PushOneCommit.Result result = createChange();
|
||||
|
||||
String username = name("new-user");
|
||||
gApi.accounts().create(username).setActive(false);
|
||||
accountOperations.newAccount().username(username).inactive().create();
|
||||
|
||||
AddReviewerInput in = new AddReviewerInput();
|
||||
in.reviewer = username;
|
||||
@@ -1714,7 +1714,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
PushOneCommit.Result result = createChange();
|
||||
|
||||
String username = "user@domain.com";
|
||||
gApi.accounts().create(username).setActive(false);
|
||||
accountOperations.newAccount().username(username).inactive().create();
|
||||
|
||||
AddReviewerInput in = new AddReviewerInput();
|
||||
in.reviewer = username;
|
||||
@@ -2096,7 +2096,7 @@ public class ChangeIT extends AbstractDaemonTest {
|
||||
ChangeResource rsrc = parseResource(r);
|
||||
String oldETag = rsrc.getETag();
|
||||
|
||||
gApi.accounts().id(admin.id.get()).setStatus("new status");
|
||||
accountOperations.account(admin.id).forUpdate().status("new status").update();
|
||||
rsrc = parseResource(r);
|
||||
assertThat(rsrc.getETag()).isNotEqualTo(oldETag);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.google.gerrit.acceptance.server.mail;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.gerrit.acceptance.testsuite.account.AccountOperations;
|
||||
import com.google.gerrit.extensions.common.ChangeInfo;
|
||||
import com.google.gerrit.extensions.common.ChangeMessageInfo;
|
||||
import com.google.gerrit.extensions.common.CommentInfo;
|
||||
@@ -33,6 +34,7 @@ import org.junit.Test;
|
||||
|
||||
public class MailProcessorIT extends AbstractMailIT {
|
||||
@Inject private MailProcessor mailProcessor;
|
||||
@Inject private AccountOperations accountOperations;
|
||||
|
||||
@Test
|
||||
public void parseAndPersistChangeMessage() throws Exception {
|
||||
@@ -163,16 +165,13 @@ public class MailProcessorIT extends AbstractMailIT {
|
||||
b.textContent(txt + textFooterForChange(changeInfo._number, ts));
|
||||
|
||||
// Set account state to inactive
|
||||
gApi.accounts().id("user").setActive(false);
|
||||
accountOperations.account(user.id).forUpdate().inactive().update();
|
||||
|
||||
mailProcessor.process(b.build());
|
||||
comments = gApi.changes().id(changeId).current().commentsAsList();
|
||||
|
||||
// Check that comment size has not changed
|
||||
assertThat(comments).hasSize(2);
|
||||
|
||||
// Reset
|
||||
gApi.accounts().id("user").setActive(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user