From a8de7029e9ace90a3d2d1f0c30f762964492df37 Mon Sep 17 00:00:00 2001 From: Michael Hoennig Date: Wed, 13 Nov 2024 10:03:33 +0100 Subject: [PATCH] query partner instead of re-using the @Required uuid --- .../scenarios/membership/CreateMembership.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/CreateMembership.java b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/CreateMembership.java index f66a0202..b7af4876 100644 --- a/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/CreateMembership.java +++ b/src/test/java/net/hostsharing/hsadminng/hs/office/scenarios/membership/CreateMembership.java @@ -1,8 +1,8 @@ package net.hostsharing.hsadminng.hs.office.scenarios.membership; import io.restassured.http.ContentType; -import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; import net.hostsharing.hsadminng.hs.office.scenarios.ScenarioTest; +import net.hostsharing.hsadminng.hs.office.scenarios.UseCase; import org.springframework.http.HttpStatus; import static io.restassured.http.ContentType.JSON; @@ -16,11 +16,17 @@ public class CreateMembership extends UseCase { @Override protected HttpResponse run() { - // FIXME: httpGet "partner.uuid": ${Partner: Test AG} + + obtain("Partner: %{partnerName}", () -> + httpGet("/api/hs/office/partners?name=&{partnerName}") + .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 httpPost("/api/hs/office/memberships", usingJsonBody(""" { - "partner.uuid": ${Partner: P-31010 - Test AG}, + "partner.uuid": ${Partner: %{partnerName}}, "memberNumberSuffix": ${memberNumberSuffix}, "status": "ACTIVE", "validFrom": ${validFrom},