Merge "AccountIT#putStatus: Unset status at test end"

This commit is contained in:
David Pursehouse
2017-11-29 08:18:03 +00:00
committed by Gerrit Code Review
2 changed files with 15 additions and 5 deletions

View File

@@ -47,7 +47,6 @@ public class TestAccount {
public final String fullName; public final String fullName;
public final KeyPair sshKey; public final KeyPair sshKey;
public final String httpPassword; public final String httpPassword;
public String status;
TestAccount( TestAccount(
Account.Id id, Account.Id id,

View File

@@ -803,9 +803,15 @@ public class AccountIT extends AbstractDaemonTest {
public void putStatus() throws Exception { public void putStatus() throws Exception {
List<String> statuses = ImmutableList.of("OOO", "Busy"); List<String> statuses = ImmutableList.of("OOO", "Busy");
AccountInfo info; AccountInfo info;
for (String status : statuses) { try {
gApi.accounts().self().setStatus(status); for (String status : statuses) {
admin.status = status; gApi.accounts().self().setStatus(status);
info = gApi.accounts().self().get();
assertUser(info, admin, status);
accountIndexedCounter.assertReindexOf(admin);
}
} finally {
gApi.accounts().self().setStatus(null);
info = gApi.accounts().self().get(); info = gApi.accounts().self().get();
assertUser(info, admin); assertUser(info, admin);
accountIndexedCounter.assertReindexOf(admin); accountIndexedCounter.assertReindexOf(admin);
@@ -2002,10 +2008,15 @@ public class AccountIT extends AbstractDaemonTest {
} }
private void assertUser(AccountInfo info, TestAccount account) throws Exception { private void assertUser(AccountInfo info, TestAccount account) throws Exception {
assertUser(info, account, null);
}
private void assertUser(AccountInfo info, TestAccount account, @Nullable String expectedStatus)
throws Exception {
assertThat(info.name).isEqualTo(account.fullName); assertThat(info.name).isEqualTo(account.fullName);
assertThat(info.email).isEqualTo(account.email); assertThat(info.email).isEqualTo(account.email);
assertThat(info.username).isEqualTo(account.username); assertThat(info.username).isEqualTo(account.username);
assertThat(info.status).isEqualTo(account.status); assertThat(info.status).isEqualTo(expectedStatus);
} }
private Set<String> getEmails() throws RestApiException { private Set<String> getEmails() throws RestApiException {