Account API: Add method to get account by integer ID
Change-Id: I7a1e7b15149892465564eaeab38c7a111386696e
This commit is contained in:
@@ -140,6 +140,19 @@ public class AccountIT extends AbstractDaemonTest {
|
||||
assertThat(info.username).isEqualTo("admin");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getByIntId() throws Exception {
|
||||
AccountInfo info = gApi
|
||||
.accounts()
|
||||
.id("admin")
|
||||
.get();
|
||||
AccountInfo infoByIntId = gApi
|
||||
.accounts()
|
||||
.id(info._accountId)
|
||||
.get();
|
||||
assertThat(info.name).isEqualTo(infoByIntId.name);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void self() throws Exception {
|
||||
AccountInfo info = gApi
|
||||
|
@@ -37,6 +37,11 @@ public interface Accounts {
|
||||
*/
|
||||
AccountApi id(String id) throws RestApiException;
|
||||
|
||||
/**
|
||||
* @see #id(String)
|
||||
*/
|
||||
AccountApi id(int id) throws RestApiException;
|
||||
|
||||
/**
|
||||
* Look up the account of the current in-scope user.
|
||||
*
|
||||
@@ -117,6 +122,11 @@ public interface Accounts {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountApi id(int id) throws RestApiException {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountApi self() throws RestApiException {
|
||||
throw new NotImplementedException();
|
||||
|
@@ -60,6 +60,11 @@ public class AccountsImpl implements Accounts {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountApi id(int id) throws RestApiException {
|
||||
return id(String.valueOf(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountApi self() throws RestApiException {
|
||||
if (!self.get().isIdentifiedUser()) {
|
||||
|
Reference in New Issue
Block a user