fix Location after add booking item

This commit is contained in:
Michael Hoennig 2024-04-16 09:14:08 +02:00
parent fd6b78b110
commit 1b24c59a2c
2 changed files with 3 additions and 3 deletions

View File

@ -60,7 +60,7 @@ public class HsBookingItemController implements HsBookingItemsApi {
final var uri =
MvcUriComponentsBuilder.fromController(getClass())
.path("/api/hs/office/bookingItems/{id}")
.path("/api/hs/booking/items/{id}")
.buildAndExpand(saved.getUuid())
.toUri();
final var mapped = mapper.map(saved, HsBookingItemResource.class, ENTITY_TO_RESOURCE_POSTMAPPER);

View File

@ -23,7 +23,7 @@ import java.util.UUID;
import static java.util.Map.entry;
import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.startsWith;
import static org.hamcrest.Matchers.matchesRegex;
@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
@ -140,7 +140,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
"resources": { "CPU": 12 }
}
"""))
.header("Location", startsWith("http://localhost"))
.header("Location", matchesRegex("http://localhost:[1-9][0-9]*/api/hs/booking/items/[^/]*"))
.extract().header("Location"); // @formatter:on
// finally, the new bookingItem can be accessed under the generated UUID