add shouldUpdatePersonData

This commit is contained in:
Michael Hoennig 2024-11-06 10:10:56 +01:00
parent 6191bf16e0
commit 16538e2524
2 changed files with 59 additions and 0 deletions

View File

@ -17,6 +17,7 @@ import net.hostsharing.hsadminng.hs.office.scenarios.partner.CreatePartner;
import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DeleteDebitor;
import net.hostsharing.hsadminng.hs.office.scenarios.partner.DeletePartner;
import net.hostsharing.hsadminng.hs.office.scenarios.partner.AddRepresentativeToPartner;
import net.hostsharing.hsadminng.hs.office.scenarios.person.ShouldUpdatePersonData;
import net.hostsharing.hsadminng.hs.office.scenarios.subscription.RemoveOperationsContactFromPartner;
import net.hostsharing.hsadminng.hs.office.scenarios.subscription.SubscribeToMailinglist;
import net.hostsharing.hsadminng.hs.office.scenarios.subscription.UnsubscribeFromMailinglist;
@ -197,6 +198,16 @@ class HsOfficeScenarioTests extends ScenarioTest {
.doRun();
}
@Test
@Order(1201)
@Requires("Partner: Michelle Matthieu")
void shouldUpdatePersonData() {
new ShouldUpdatePersonData(this)
.given("oldFamilyName", "Matthieu")
.given("newFamilyName", "Matthieu-Zhang")
.doRun();
}
@Test
@Order(2010)
@Requires("Partner: Test AG")

View File

@ -0,0 +1,48 @@
package net.hostsharing.hsadminng.hs.office.scenarios.person;
import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest;
import net.hostsharing.hsadminng.hs.office.scenarios.UseCase;
import org.springframework.http.HttpStatus;
import static io.restassured.http.ContentType.JSON;
import static org.springframework.http.HttpStatus.OK;
public class ShouldUpdatePersonData extends UseCase<ShouldUpdatePersonData> {
public ShouldUpdatePersonData(final ScenarioTest testSuite) {
super(testSuite);
}
@Override
protected HttpResponse run() {
obtain(
"personUuid",
() -> httpGet("/api/hs/office/persons?name=" + uriEncoded("%{oldFamilyName}"))
.expecting(OK).expecting(JSON),
response -> response.expectArrayElements(1).getFromBody("[0].uuid"),
"In production, data this query could result in multiple outputs. In that case, you have to find out which is the right one."
);
withTitle("Patch the Additional Phone-Number into the Person", () ->
httpPatch("/api/hs/office/persons/%{personUuid}", usingJsonBody("""
{
"familyName": ${newFamilyName}
}
"""))
.expecting(HttpStatus.OK)
);
return null;
}
@Override
protected void verify() {
verify(
"Verify if the New Phone Number Got Added",
() -> httpGet("/api/hs/office/persons/%{personUuid}")
.expecting(OK).expecting(JSON),
path("familyName").contains("%{newFamilyName}")
);
}
}