feature/use-case-acceptance-tests #116
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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<UnsubscribeFromMailinglist> {
|
||||
|
||||
@ -14,7 +16,16 @@ public class UnsubscribeFromMailinglist extends UseCase<UnsubscribeFromMailingli
|
||||
@Override
|
||||
protected HttpResponse run() {
|
||||
|
||||
return httpDelete("/api/hs/office/relations/" + uuid("subscriptionUuid"))
|
||||
obtain("Subscription: %{subscriberEMailAddress}", () ->
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user