explicitly fetch Dennis Krause in RemoveOperationsContactFromPartner
This commit is contained in:
parent
e5cc1da71a
commit
bc099ada40
@ -94,7 +94,7 @@ class HsOfficeScenarioTests extends ScenarioTest {
|
||||
@Requires("Operations-Contact: Dennis Krause for Test AG")
|
||||
void shouldRemoveOperationsContactFromPartner() {
|
||||
new RemoveOperationsContactFromPartner(this)
|
||||
.given("operationContactRelationUuid", "%{Operations-Contact: Dennis Krause for Test AG}")
|
||||
.given("operationsContactPerson", "Dennis Krause")
|
||||
.doRun();
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ 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();
|
||||
}
|
||||
|
||||
@ -137,9 +138,10 @@ public abstract class ScenarioTest extends ContextBasedTest {
|
||||
return aliases.containsKey(alias);
|
||||
}
|
||||
|
||||
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 [" +
|
||||
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 [" +
|
||||
knowVariables().keySet().stream().map(v -> "'" + v + "'").collect(Collectors.joining(", ")) + "]"
|
||||
).isNotNull();
|
||||
return alias;
|
||||
|
@ -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 RemoveOperationsContactFromPartner extends UseCase<RemoveOperationsContactFromPartner> {
|
||||
|
||||
@ -14,7 +16,14 @@ public class RemoveOperationsContactFromPartner extends UseCase<RemoveOperations
|
||||
@Override
|
||||
protected HttpResponse run() {
|
||||
|
||||
return httpDelete("/api/hs/office/relations/" + uuid("operationContactRelationUuid"))
|
||||
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}"))
|
||||
.expecting(NO_CONTENT);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user