Allow to set active flag from new test API for accounts
Change-Id: I0c3d0ed1f3b11bb4e4c7e9cae769ac9147aa5bf8 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
parent
50a577d314
commit
6d8a2d0ff5
|
@ -82,6 +82,7 @@ public class AccountOperationsImpl implements AccountOperations {
|
|||
String httpPassword = accountCreation.httpPassword().orElse(null);
|
||||
accountCreation.username().ifPresent(u -> setUsername(builder, accountId, u, httpPassword));
|
||||
accountCreation.status().ifPresent(builder::setStatus);
|
||||
accountCreation.active().ifPresent(builder::setActive);
|
||||
}
|
||||
|
||||
private static TestAccount toTestAccount(AccountState accountState) {
|
||||
|
@ -91,6 +92,7 @@ public class AccountOperationsImpl implements AccountOperations {
|
|||
.preferredEmail(Optional.ofNullable(createdAccount.getPreferredEmail()))
|
||||
.fullname(Optional.ofNullable(createdAccount.getFullName()))
|
||||
.username(accountState.getUserName())
|
||||
.active(accountState.getAccount().isActive())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -159,6 +161,7 @@ public class AccountOperationsImpl implements AccountOperations {
|
|||
String httpPassword = accountUpdate.httpPassword().orElse(null);
|
||||
accountUpdate.username().ifPresent(u -> setUsername(builder, accountId, u, httpPassword));
|
||||
accountUpdate.status().ifPresent(builder::setStatus);
|
||||
accountUpdate.active().ifPresent(builder::setActive);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@ public abstract class TestAccount {
|
|||
|
||||
public abstract Optional<String> username();
|
||||
|
||||
public abstract boolean active();
|
||||
|
||||
static Builder builder() {
|
||||
return new AutoValue_TestAccount.Builder();
|
||||
}
|
||||
|
@ -42,6 +44,8 @@ public abstract class TestAccount {
|
|||
|
||||
abstract Builder username(Optional<String> username);
|
||||
|
||||
abstract Builder active(boolean active);
|
||||
|
||||
abstract TestAccount build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,8 @@ public abstract class TestAccountCreation {
|
|||
|
||||
public abstract Optional<String> status();
|
||||
|
||||
public abstract Optional<Boolean> active();
|
||||
|
||||
abstract ThrowingFunction<TestAccountCreation, TestAccount> accountCreator();
|
||||
|
||||
public static Builder builder(ThrowingFunction<TestAccountCreation, TestAccount> accountCreator) {
|
||||
|
@ -70,6 +72,16 @@ public abstract class TestAccountCreation {
|
|||
return status("");
|
||||
}
|
||||
|
||||
abstract Builder active(boolean active);
|
||||
|
||||
public Builder active() {
|
||||
return active(true);
|
||||
}
|
||||
|
||||
public Builder inactive() {
|
||||
return active(false);
|
||||
}
|
||||
|
||||
abstract Builder accountCreator(
|
||||
ThrowingFunction<TestAccountCreation, TestAccount> accountCreator);
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ public abstract class TestAccountUpdate {
|
|||
|
||||
public abstract Optional<String> status();
|
||||
|
||||
public abstract Optional<Boolean> active();
|
||||
|
||||
abstract ThrowingFunction<TestAccountUpdate, TestAccount> accountUpdater();
|
||||
|
||||
public static Builder builder(ThrowingFunction<TestAccountUpdate, TestAccount> accountUpdater) {
|
||||
|
@ -70,6 +72,16 @@ public abstract class TestAccountUpdate {
|
|||
return status("");
|
||||
}
|
||||
|
||||
abstract Builder active(boolean active);
|
||||
|
||||
public Builder active() {
|
||||
return active(true);
|
||||
}
|
||||
|
||||
public Builder inactive() {
|
||||
return active(false);
|
||||
}
|
||||
|
||||
abstract Builder accountUpdater(
|
||||
ThrowingFunction<TestAccountUpdate, TestAccount> accountUpdater);
|
||||
|
||||
|
|
Loading…
Reference in New Issue