Search in sources :

Example 1 with GetUserRequest

use of org.haiku.haikudepotserver.api1.model.user.GetUserRequest in project haikudepotserver by haiku.

the class UserApiIT method testGetUser_foundWithUserUsageConditionsAgreement.

@Test
public void testGetUser_foundWithUserUsageConditionsAgreement() {
    ObjectContext context = serverRuntime.newContext();
    User user = integrationTestSupportService.createBasicUser(context, "testuser", "yUe4o2Nwe009");
    integrationTestSupportService.agreeToUserUsageConditions(context, user);
    setAuthenticatedUser("testuser");
    // ------------------------------------
    GetUserResult result = userApi.getUser(new GetUserRequest("testuser"));
    // ------------------------------------
    // just check the few things that come with the additional user usage agreement
    Assertions.assertThat(result.userUsageConditionsAgreement.timestampAgreed).isNotNull();
    Assertions.assertThat(result.userUsageConditionsAgreement.userUsageConditionsCode).isEqualTo("UUC2021V01");
}
Also used : GetUserResult(org.haiku.haikudepotserver.api1.model.user.GetUserResult) User(org.haiku.haikudepotserver.dataobjects.User) GetUserRequest(org.haiku.haikudepotserver.api1.model.user.GetUserRequest) ObjectContext(org.apache.cayenne.ObjectContext) AbstractIntegrationTest(org.haiku.haikudepotserver.AbstractIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 2 with GetUserRequest

use of org.haiku.haikudepotserver.api1.model.user.GetUserRequest in project haikudepotserver by haiku.

the class UserApiIT method testGetUser_found.

@Test
public void testGetUser_found() {
    ObjectContext context = serverRuntime.newContext();
    integrationTestSupportService.createBasicUser(context, "testuser", "yUe4o2Nwe009");
    setAuthenticatedUser("testuser");
    // ------------------------------------
    GetUserResult result = userApi.getUser(new GetUserRequest("testuser"));
    // ------------------------------------
    Assertions.assertThat(result.nickname).isEqualTo("testuser");
    Assertions.assertThat(result.lastAuthenticationTimestamp).isNull();
    Assertions.assertThat(result.createTimestamp).isNotNull();
    Assertions.assertThat(result.userUsageConditionsAgreement).isNull();
// more to come here in time
}
Also used : GetUserResult(org.haiku.haikudepotserver.api1.model.user.GetUserResult) GetUserRequest(org.haiku.haikudepotserver.api1.model.user.GetUserRequest) ObjectContext(org.apache.cayenne.ObjectContext) AbstractIntegrationTest(org.haiku.haikudepotserver.AbstractIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

ObjectContext (org.apache.cayenne.ObjectContext)2 AbstractIntegrationTest (org.haiku.haikudepotserver.AbstractIntegrationTest)2 GetUserRequest (org.haiku.haikudepotserver.api1.model.user.GetUserRequest)2 GetUserResult (org.haiku.haikudepotserver.api1.model.user.GetUserResult)2 Test (org.junit.jupiter.api.Test)2 User (org.haiku.haikudepotserver.dataobjects.User)1