explicitly fetch Test AG in AddOperationsContactToPartner

This commit is contained in:
Michael Hoennig 2024-10-30 06:55:39 +01:00
parent 31f5bcc5d8
commit 8721400226
2 changed files with 10 additions and 2 deletions

View File

@ -80,7 +80,7 @@ class HsOfficeScenarioTests extends ScenarioTest {
@Produces("Operations-Contact: Dennis Krause for Test AG")
void shouldAddOperationsContactToPartner() {
new AddOperationsContactToPartner(this)
.given("partnerPersonUuid", "%{Person: Test AG}")
.given("partnerPersonTradeName", "Test AG")
.given("operationsContactFamilyName", "Krause")
.given("operationsContactGivenName", "Dennis")
.given("operationsContactPhoneNumber", "+49 9932 587741")

View File

@ -7,6 +7,7 @@ import org.springframework.http.HttpStatus;
import static io.restassured.http.ContentType.JSON;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.OK;
public class AddOperationsContactToPartner extends UseCase<AddOperationsContactToPartner> {
@ -16,6 +17,13 @@ public class AddOperationsContactToPartner extends UseCase<AddOperationsContactT
@Override
protected HttpResponse run() {
keep("Person: %{partnerPersonTradeName}", () ->
httpGet("/api/hs/office/persons?name=" + uriEncoded("%{partnerPersonTradeName}"))
.expecting(OK).expecting(JSON),
response -> response.expectArrayElements(1).getFromBody("[0].uuid")
);
keep("Person: %{operationsContactGivenName} %{operationsContactFamilyName}",
() ->
httpPost("/api/hs/office/persons", usingJsonBody("""
@ -49,7 +57,7 @@ public class AddOperationsContactToPartner extends UseCase<AddOperationsContactT
return httpPost("/api/hs/office/relations", usingJsonBody("""
{
"type": "OPERATIONS",
"anchorUuid": ${partnerPersonUuid},
"anchorUuid": ${Person: %{partnerPersonTradeName}},
"holderUuid": ${Person: %{operationsContactGivenName} %{operationsContactFamilyName}},
"contactUuid": ${Contact: %{operationsContactGivenName} %{operationsContactFamilyName}}
}