feature/use-case-acceptance-tests-3 #119

Merged
hsh-michaelhoennig merged 4 commits from feature/use-case-acceptance-tests-3 into master 2024-11-07 10:11:53 +01:00
2 changed files with 59 additions and 0 deletions
Showing only changes of commit 16538e2524 - Show all commits

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