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 23ff1d5c..c3512b34 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 @@ -3,8 +3,8 @@ package net.hostsharing.hsadminng.hs.office.scenarios; import net.hostsharing.hsadminng.HsadminNgApplication; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateExternalDebitorForPartner; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSelfDebitorForPartner; -import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSepaMandataForDebitor; -import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DeleteSepaMandataForDebitor; +import net.hostsharing.hsadminng.hs.office.scenarios.debitor.CreateSepaMandateForDebitor; +import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DeleteSepaMandateForDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.DontDeleteDefaultDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.debitor.InvalidateSepaMandateForDebitor; import net.hostsharing.hsadminng.hs.office.scenarios.membership.CreateMembership; @@ -233,7 +233,8 @@ class HsOfficeScenarioTests extends ScenarioTest { @Requires("Subscription: Michael Miller to operations-announce") void shouldUnsubscribeNewPersonAndContactToMailinglist() { new UnsubscribeFromMailinglist(this) - .given("subscriptionUuid", "%{Subscription: Michael Miller to operations-announce}") + .given("mailingList", "operations-announce") + .given("subscriberEMailAddress", "michael.miller@example.org") .doRun(); } } diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/UnsubscribeFromMailinglist.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/UnsubscribeFromMailinglist.java index b0754161..6f059902 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/UnsubscribeFromMailinglist.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/subscription/UnsubscribeFromMailinglist.java @@ -3,7 +3,9 @@ package net.hostsharing.hsadminng.hs.office.scenarios.subscription; import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; +import static io.restassured.http.ContentType.JSON; import static org.springframework.http.HttpStatus.NO_CONTENT; +import static org.springframework.http.HttpStatus.OK; public class UnsubscribeFromMailinglist extends UseCase { @@ -14,7 +16,16 @@ public class UnsubscribeFromMailinglist extends UseCase + httpGet("/api/hs/office/relations?relationType=SUBSCRIBER" + + "&mark=" + uriEncoded("%{mailingList}") + + "&contactData=" + uriEncoded("%{subscriberEMailAddress}")) + .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." + ); + + return httpDelete("/api/hs/office/relations/" + uuid("Subscription: %{subscriberEMailAddress}")) .expecting(NO_CONTENT); } }