explicitly fetch Test AG in SubscribeToMailinglist
This commit is contained in:
parent
619e5f288c
commit
84a0799065
@ -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")
|
||||
|
@ -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<SubscribeToMailinglist> {
|
||||
|
||||
@ -16,6 +17,14 @@ public class SubscribeToMailinglist extends UseCase<SubscribeToMailinglist> {
|
||||
|
||||
@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<SubscribeToMailinglist> {
|
||||
{
|
||||
"type": "SUBSCRIBER",
|
||||
"mark": ${mailingList},
|
||||
"anchorUuid": ${partnerPersonUuid},
|
||||
"anchorUuid": ${Person: %{partnerPersonTradeName}},
|
||||
"holderUuid": ${Person: %{subscriberGivenName} %{subscriberFamilyName}},
|
||||
"contactUuid": ${Contact: %{subscriberGivenName} %{subscriberFamilyName}}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user