directly use projectRepo to fetch test-data
This commit is contained in:
parent
7e608068e6
commit
b1cf2ed04a
@ -284,7 +284,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
|||||||
@Test
|
@Test
|
||||||
void globalAdmin_canPatchAllUpdatablePropertiesOfBookingItem() {
|
void globalAdmin_canPatchAllUpdatablePropertiesOfBookingItem() {
|
||||||
|
|
||||||
final var givenBookingItem = givenSomeNewBookingItem(1000111, MANAGED_WEBSPACE,
|
final var givenBookingItem = givenSomeNewBookingItem("D-1000111 default project", MANAGED_WEBSPACE,
|
||||||
resource("HDD", 100), resource("SSD", 50), resource("Traffic", 250));
|
resource("HDD", 100), resource("SSD", 50), resource("Traffic", 250));
|
||||||
|
|
||||||
RestAssured // @formatter:off
|
RestAssured // @formatter:off
|
||||||
@ -339,7 +339,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
|||||||
@Test
|
@Test
|
||||||
void globalAdmin_canDeleteArbitraryBookingItem() {
|
void globalAdmin_canDeleteArbitraryBookingItem() {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenBookingItem = givenSomeNewBookingItem(1000111, MANAGED_WEBSPACE,
|
final var givenBookingItem = givenSomeNewBookingItem("D-1000111 default project", MANAGED_WEBSPACE,
|
||||||
resource("HDD", 100), resource("SSD", 50), resource("Traffic", 250));
|
resource("HDD", 100), resource("SSD", 50), resource("Traffic", 250));
|
||||||
|
|
||||||
RestAssured // @formatter:off
|
RestAssured // @formatter:off
|
||||||
@ -358,7 +358,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
|||||||
@Test
|
@Test
|
||||||
void normalUser_canNotDeleteUnrelatedBookingItem() {
|
void normalUser_canNotDeleteUnrelatedBookingItem() {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
final var givenBookingItem = givenSomeNewBookingItem(1000111, MANAGED_WEBSPACE,
|
final var givenBookingItem = givenSomeNewBookingItem("D-1000111 default project", MANAGED_WEBSPACE,
|
||||||
resource("HDD", 100), resource("SSD", 50), resource("Traffic", 250));
|
resource("HDD", 100), resource("SSD", 50), resource("Traffic", 250));
|
||||||
|
|
||||||
RestAssured // @formatter:off
|
RestAssured // @formatter:off
|
||||||
@ -376,14 +376,11 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
private HsBookingItemEntity givenSomeNewBookingItem(final int debitorNumber,
|
private HsBookingItemEntity givenSomeNewBookingItem(final String projectCaption,
|
||||||
final HsBookingItemType hsBookingItemType, final Map.Entry<String, Object>... resources) {
|
final HsBookingItemType hsBookingItemType, final Map.Entry<String, Object>... resources) {
|
||||||
return jpaAttempt.transacted(() -> {
|
return jpaAttempt.transacted(() -> {
|
||||||
context.define("superuser-alex@hostsharing.net");
|
context.define("superuser-alex@hostsharing.net");
|
||||||
// FIXME: use projectRepo directly
|
final var givenProject = projectRepo.findByCaption(projectCaption).stream()
|
||||||
final var givenProject = debitorRepo.findDebitorByDebitorNumber(debitorNumber).stream()
|
|
||||||
.map(d -> projectRepo.findAllByDebitorUuid(d.getUuid()))
|
|
||||||
.flatMap(java.util.List::stream)
|
|
||||||
.findAny().orElseThrow();
|
.findAny().orElseThrow();
|
||||||
final var newBookingItem = HsBookingItemEntity.builder()
|
final var newBookingItem = HsBookingItemEntity.builder()
|
||||||
.uuid(UUID.randomUUID())
|
.uuid(UUID.randomUUID())
|
||||||
|
@ -63,7 +63,6 @@ public abstract class ContextBasedTestWithCleanup extends ContextBasedTest {
|
|||||||
return merged;
|
return merged;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: remove HsOfficeCoopAssetsTransactionRawEntity, which is not needed anymore after this change
|
|
||||||
public UUID toCleanup(final Class<? extends RbacObject> entityClass, final UUID uuidToCleanup) {
|
public UUID toCleanup(final Class<? extends RbacObject> entityClass, final UUID uuidToCleanup) {
|
||||||
out.println("toCleanup(" + entityClass.getSimpleName() + ", " + uuidToCleanup + ")");
|
out.println("toCleanup(" + entityClass.getSimpleName() + ", " + uuidToCleanup + ")");
|
||||||
entitiesToCleanup.put(uuidToCleanup, entityClass);
|
entitiesToCleanup.put(uuidToCleanup, entityClass);
|
||||||
|
Loading…
Reference in New Issue
Block a user