use of org.haiku.haikudepotserver.api1.model.user.RenewTokenResult in project haikudepotserver by haiku.
the class UserApiIT method testRenewToken.
@Test
public void testRenewToken() {
String token;
ObjectId userOid;
{
ObjectContext context = serverRuntime.newContext();
User user = integrationTestSupportService.createBasicUser(context, "testuser", "U7vqpsu6BB");
userOid = user.getObjectId();
token = userAuthenticationService.generateToken(user);
}
RenewTokenRequest renewTokenRequest = new RenewTokenRequest();
renewTokenRequest.token = token;
// ------------------------------------
RenewTokenResult result = userApi.renewToken(renewTokenRequest);
// ------------------------------------
{
Optional<ObjectId> afterUserObjectId = userAuthenticationService.authenticateByToken(result.token);
Assertions.assertThat(userOid).isEqualTo(afterUserObjectId.get());
}
}
Aggregations