Compare commits
No commits in common. "bc099ada40000096bcfd96db6e1517cdad290187" and "87214002263d3e36bf9c709129ad58563f4b4c82" have entirely different histories.
bc099ada40
...
8721400226
@ -94,7 +94,7 @@ class HsOfficeScenarioTests extends ScenarioTest {
|
||||
@Requires("Operations-Contact: Dennis Krause for Test AG")
|
||||
void shouldRemoveOperationsContactFromPartner() {
|
||||
new RemoveOperationsContactFromPartner(this)
|
||||
.given("operationsContactPerson", "Dennis Krause")
|
||||
.given("operationContactRelationUuid", "%{Operations-Contact: Dennis Krause for Test AG}")
|
||||
.doRun();
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,6 @@ public abstract class ScenarioTest extends ContextBasedTest {
|
||||
@AfterEach
|
||||
void cleanup() { // final TestInfo testInfo
|
||||
properties.clear();
|
||||
// FIXME: Delete all aliases as well to force HTTP GET queries in each scenario?
|
||||
testReport.close();
|
||||
}
|
||||
|
||||
@ -138,10 +137,9 @@ public abstract class ScenarioTest extends ContextBasedTest {
|
||||
return aliases.containsKey(alias);
|
||||
}
|
||||
|
||||
static UUID uuid(final String nameWithPlaceholders) {
|
||||
final var resoledName = resolve(nameWithPlaceholders);
|
||||
final UUID alias = ofNullable(knowVariables().get(resoledName)).filter(v -> v instanceof UUID).map(UUID.class::cast).orElse(null);
|
||||
assertThat(alias).as("alias '" + resoledName + "' not found in aliases nor in properties [" +
|
||||
static UUID uuid(final String name) {
|
||||
final UUID alias = ofNullable(knowVariables().get(name)).filter(v -> v instanceof UUID).map(UUID.class::cast).orElse(null);
|
||||
assertThat(alias).as("alias '" + name + "' not found in aliases nor in properties [" +
|
||||
knowVariables().keySet().stream().map(v -> "'" + v + "'").collect(Collectors.joining(", ")) + "]"
|
||||
).isNotNull();
|
||||
return alias;
|
||||
|
@ -19,8 +19,8 @@ public class CreateSelfDebitorForPartner extends UseCase<CreateSelfDebitorForPar
|
||||
httpGet("/api/hs/office/relations?relationType=PARTNER&personData=" + uriEncoded("%{partnerPersonTradeName}"))
|
||||
.expecting(OK).expecting(JSON),
|
||||
response -> response.expectArrayElements(1).getFromBody("[0].holder.uuid"),
|
||||
"In production data this query could result in multiple outputs. In that case, you have to find out which is the right one.",
|
||||
"**HINT**: With production data, you might get multiple results and have to decide which is the right one."
|
||||
"From that output above, we're taking the UUID of the holder of the first result element.",
|
||||
"**HINT**: With production data, you might get multiple results and have to decide which is the right one."
|
||||
);
|
||||
|
||||
keep("BankAccount: Test AG - refund bank account", () ->
|
||||
|
@ -21,8 +21,7 @@ public class AddOperationsContactToPartner extends UseCase<AddOperationsContactT
|
||||
keep("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."
|
||||
response -> response.expectArrayElements(1).getFromBody("[0].uuid")
|
||||
);
|
||||
|
||||
keep("Person: %{operationsContactGivenName} %{operationsContactFamilyName}",
|
||||
|
@ -21,8 +21,7 @@ public class AddRepresentativeToPartner extends UseCase<AddRepresentativeToPartn
|
||||
keep("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."
|
||||
response -> response.expectArrayElements(1).getFromBody("[0].uuid")
|
||||
);
|
||||
|
||||
keep("Person: %{representativeGivenName} %{representativeFamilyName}", () ->
|
||||
|
@ -24,8 +24,7 @@ public class CreatePartner extends UseCase<CreatePartner> {
|
||||
keep("Person: Hostsharing eG", () ->
|
||||
httpGet("/api/hs/office/persons?name=Hostsharing+eG")
|
||||
.expecting(OK).expecting(JSON),
|
||||
response -> response.expectArrayElements(1).getFromBody("[0].uuid"),
|
||||
"Even in production data we expect this query to return just a single result." // TODO.impl: add constraint?
|
||||
response -> response.expectArrayElements(1).getFromBody("[0].uuid")
|
||||
);
|
||||
|
||||
keep("Person: %{tradeName}", () ->
|
||||
|
@ -3,9 +3,7 @@ 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 RemoveOperationsContactFromPartner extends UseCase<RemoveOperationsContactFromPartner> {
|
||||
|
||||
@ -16,14 +14,7 @@ public class RemoveOperationsContactFromPartner extends UseCase<RemoveOperations
|
||||
@Override
|
||||
protected HttpResponse run() {
|
||||
|
||||
keep("Operations-Contact: %{operationsContactPerson}", () ->
|
||||
httpGet("/api/hs/office/relations?relationType=OPERATIONS&name=" + uriEncoded("%{operationsContactPerson}"))
|
||||
.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("Operations-Contact: %{operationsContactPerson}"))
|
||||
return httpDelete("/api/hs/office/relations/" + uuid("operationContactRelationUuid"))
|
||||
.expecting(NO_CONTENT);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user