diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java index 2ec80c6a..23ff1d5c 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/HsOfficeScenarioTests.java @@ -219,7 +219,7 @@ class HsOfficeScenarioTests extends ScenarioTest { void shouldSubscribeNewPersonAndContactToMailinglist() { new SubscribeToMailinglist(this) // TODO.spec: do we need the personType? or is an operational contact always a natural person? what about distribution lists? - .given("partnerPersonUuid", "%{Person: Test AG}") + .given("partnerPersonTradeName", "Test AG") .given("subscriberFamilyName", "Miller") .given("subscriberGivenName", "Michael") .given("subscriberEMailAddress", "michael.miller@example.org") diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/SubscribeToMailinglist.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/SubscribeToMailinglist.java index ecf22305..3c84603f 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/SubscribeToMailinglist.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/SubscribeToMailinglist.java @@ -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 SubscribeToMailinglist extends UseCase { @@ -16,6 +17,14 @@ public class SubscribeToMailinglist extends UseCase { @Override protected HttpResponse run() { + + obtain("Person: %{partnerPersonTradeName}", () -> + httpGet("/api/hs/office/persons?name=" + uriEncoded("%{partnerPersonTradeName}")) + .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." + ); + obtain("Person: %{subscriberGivenName} %{subscriberFamilyName}", () -> httpPost("/api/hs/office/persons", usingJsonBody(""" { @@ -43,7 +52,7 @@ public class SubscribeToMailinglist extends UseCase { { "type": "SUBSCRIBER", "mark": ${mailingList}, - "anchorUuid": ${partnerPersonUuid}, + "anchorUuid": ${Person: %{partnerPersonTradeName}}, "holderUuid": ${Person: %{subscriberGivenName} %{subscriberFamilyName}}, "contactUuid": ${Contact: %{subscriberGivenName} %{subscriberFamilyName}} }