Search in sources :

Example 11 with UserAssignment

use of ch.aaap.harvestclient.domain.UserAssignment 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 12 with UserAssignment

use of ch.aaap.harvestclient.domain.UserAssignment 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

UserAssignment (ch.aaap.harvestclient.domain.UserAssignment)12 HarvestTest (ch.aaap.harvestclient.HarvestTest)9 ImmutableUserAssignment (ch.aaap.harvestclient.domain.ImmutableUserAssignment)9 Test (org.junit.jupiter.api.Test)9 UserAssignmentFilter (ch.aaap.harvestclient.api.filter.UserAssignmentFilter)4 ImmutableUserAssignmentUpdateInfo (ch.aaap.harvestclient.domain.param.ImmutableUserAssignmentUpdateInfo)3 UserAssignmentUpdateInfo (ch.aaap.harvestclient.domain.param.UserAssignmentUpdateInfo)3 User (ch.aaap.harvestclient.domain.User)2 UserAssignmentsApi (ch.aaap.harvestclient.api.UserAssignmentsApi)1 Harvest (ch.aaap.harvestclient.core.Harvest)1 Project (ch.aaap.harvestclient.domain.Project)1 Reference (ch.aaap.harvestclient.domain.reference.Reference)1 Instant (java.time.Instant)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 AfterEach (org.junit.jupiter.api.AfterEach)1 ExistingData (util.ExistingData)1 TestSetupUtil (util.TestSetupUtil)1