use of org.aion.rpc.types.RPCTypes.UnlockAccountParams in project aion by aionnetwork.
the class PersonalRPCImplTest method testPersonal_unlockAccount.
@Test
public void testPersonal_unlockAccount() {
AionAddress address = new AionAddress(ByteUtil.hexStringToBytes("a07913c03686c9659c1b614d098fd1db380a52b71fd58526b53d8107f7b355d5"));
String password0 = "password";
String password1 = "password1";
int timeout0 = 300;
Integer timeout1 = null;
UnlockAccountParams params0 = new UnlockAccountParams(address, password0, timeout0);
UnlockAccountParams params1 = new UnlockAccountParams(address, password1, timeout1);
// check that the rpc library creates a default value for the duration
assertNotNull(params1.duration);
doReturn(false).when(chainHolder).unlockAccount(eq(address), eq(password0), anyInt());
doReturn(true).when(chainHolder).unlockAccount(eq(address), eq(password1), anyInt());
assertFalse(execute(new Request(idGenerator.generateID(), unlockAccountMethod, UnlockAccountParamsConverter.encode(params0), VersionType.Version2), BoolConverter::decode));
assertTrue(execute(new Request(idGenerator.generateID(), unlockAccountMethod, UnlockAccountParamsConverter.encode(params1), VersionType.Version2), BoolConverter::decode));
}
Aggregations