Search in sources :

Example 1 with UserAssignmentUpdateInfo

use of ch.aaap.harvestclient.domain.param.UserAssignmentUpdateInfo in project harvest-client by 3AP-AG.

the class UserAssignmentsApiUpdateTest method changeActive.

@Test
void changeActive() {
    userAssignment = userAssignmentApi.create(projectReference, ImmutableUserAssignment.builder().user(userReference).build());
    UserAssignmentUpdateInfo updateInfo = ImmutableUserAssignmentUpdateInfo.builder().active(false).build();
    UserAssignment updatedUserAssignment = userAssignmentApi.update(projectReference, userAssignment, updateInfo);
    assertThat(updatedUserAssignment.getActive()).isEqualTo(updateInfo.getActive());
}
Also used : ImmutableUserAssignment(ch.aaap.harvestclient.domain.ImmutableUserAssignment) UserAssignment(ch.aaap.harvestclient.domain.UserAssignment) UserAssignmentUpdateInfo(ch.aaap.harvestclient.domain.param.UserAssignmentUpdateInfo) ImmutableUserAssignmentUpdateInfo(ch.aaap.harvestclient.domain.param.ImmutableUserAssignmentUpdateInfo) HarvestTest(ch.aaap.harvestclient.HarvestTest) Test(org.junit.jupiter.api.Test)

Example 2 with UserAssignmentUpdateInfo

use of ch.aaap.harvestclient.domain.param.UserAssignmentUpdateInfo in project harvest-client by 3AP-AG.

the class UserAssignmentsApiUpdateTest method changeUser.

@Test
void changeUser() {
    Reference<User> anotherUserReference = ExistingData.getInstance().getAnotherUserReference();
    userAssignment = userAssignmentApi.create(projectReference, ImmutableUserAssignment.builder().user(userReference).build());
    UserAssignmentUpdateInfo updateInfo = ImmutableUserAssignmentUpdateInfo.builder().user(anotherUserReference).build();
    UserAssignment updatedUserAssignment = userAssignmentApi.update(projectReference, userAssignment, updateInfo);
    // Changing user id has been disabled by Harvest
    assertThat(updatedUserAssignment.getUser().getId()).isEqualTo(userReference.getId());
}
Also used : User(ch.aaap.harvestclient.domain.User) ImmutableUserAssignment(ch.aaap.harvestclient.domain.ImmutableUserAssignment) UserAssignment(ch.aaap.harvestclient.domain.UserAssignment) UserAssignmentUpdateInfo(ch.aaap.harvestclient.domain.param.UserAssignmentUpdateInfo) ImmutableUserAssignmentUpdateInfo(ch.aaap.harvestclient.domain.param.ImmutableUserAssignmentUpdateInfo) HarvestTest(ch.aaap.harvestclient.HarvestTest) Test(org.junit.jupiter.api.Test)

Example 3 with UserAssignmentUpdateInfo

use of ch.aaap.harvestclient.domain.param.UserAssignmentUpdateInfo in project harvest-client by 3AP-AG.

the class UserAssignmentsApiUpdateTest method changeAll.

@Test
void changeAll() {
    userAssignment = userAssignmentApi.create(projectReference, ImmutableUserAssignment.builder().user(userReference).build());
    UserAssignmentUpdateInfo updateInfo = ImmutableUserAssignmentUpdateInfo.builder().hourlyRate(110.).budget(11111111.).build();
    UserAssignment updatedUserAssignment = userAssignmentApi.update(projectReference, userAssignment, updateInfo);
    assertThat(updatedUserAssignment).isEqualToComparingOnlyGivenFields(updateInfo, "hourlyRate", "budget");
}
Also used : ImmutableUserAssignment(ch.aaap.harvestclient.domain.ImmutableUserAssignment) UserAssignment(ch.aaap.harvestclient.domain.UserAssignment) UserAssignmentUpdateInfo(ch.aaap.harvestclient.domain.param.UserAssignmentUpdateInfo) ImmutableUserAssignmentUpdateInfo(ch.aaap.harvestclient.domain.param.ImmutableUserAssignmentUpdateInfo) HarvestTest(ch.aaap.harvestclient.HarvestTest) Test(org.junit.jupiter.api.Test)

Aggregations

HarvestTest (ch.aaap.harvestclient.HarvestTest)3 ImmutableUserAssignment (ch.aaap.harvestclient.domain.ImmutableUserAssignment)3 UserAssignment (ch.aaap.harvestclient.domain.UserAssignment)3 ImmutableUserAssignmentUpdateInfo (ch.aaap.harvestclient.domain.param.ImmutableUserAssignmentUpdateInfo)3 UserAssignmentUpdateInfo (ch.aaap.harvestclient.domain.param.UserAssignmentUpdateInfo)3 Test (org.junit.jupiter.api.Test)3 User (ch.aaap.harvestclient.domain.User)1