Search in sources :

Example 1 with LockAccountParams

use of org.aion.rpc.types.RPCTypes.LockAccountParams in project aion by aionnetwork.

the class PersonalRPCImplTest method testPersonal_lockAccount.

@Test
public void testPersonal_lockAccount() {
    AionAddress address = new AionAddress(ByteUtil.hexStringToBytes("a07913c03686c9659c1b614d098fd1db380a52b71fd58526b53d8107f7b355d5"));
    String password0 = "password";
    String password1 = "password1";
    LockAccountParams params0 = new LockAccountParams(address, password0);
    LockAccountParams params1 = new LockAccountParams(address, password1);
    doReturn(false).when(chainHolder).lockAccount(eq(address), eq(password0));
    doReturn(true).when(chainHolder).lockAccount(eq(address), eq(password1));
    assertFalse(execute(new Request(idGenerator.generateID(), lockAccountMethod, LockAccountParamsConverter.encode(params0), VersionType.Version2), BoolConverter::decode));
    assertTrue(execute(new Request(idGenerator.generateID(), lockAccountMethod, LockAccountParamsConverter.encode(params1), VersionType.Version2), BoolConverter::decode));
}
Also used : AionAddress(org.aion.types.AionAddress) Request(org.aion.rpc.types.RPCTypes.Request) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) LockAccountParams(org.aion.rpc.types.RPCTypes.LockAccountParams) Test(org.junit.Test)

Aggregations

LockAccountParams (org.aion.rpc.types.RPCTypes.LockAccountParams)1 Request (org.aion.rpc.types.RPCTypes.Request)1 AionAddress (org.aion.types.AionAddress)1 Test (org.junit.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1