add assigned-asset, add more hosting-asset test-data and introduce HsBookingDebitor+hs_booking_debitor_rv #58

Merged
hsh-michaelhoennig merged 8 commits from add-assigned-asset-and-more-hosting-asset-test-data into master 2024-06-06 13:46:15 +02:00
3 changed files with 14 additions and 9 deletions
Showing only changes of commit 5ea8b73b86 - Show all commits

View File

@ -118,10 +118,13 @@ begin
sql = format($sql$
create or replace function %1$sUuidByIdName(givenIdName varchar)
returns uuid
language sql
strict as $f$
select uuid from %1$s_iv iv where iv.idName = givenIdName;
$f$;
language plpgsql as $f$
declare
singleMatch uuid;
begin
select uuid into strict singleMatch from %1$s_iv iv where iv.idName = givenIdName;
return singleMatch;
end; $f$;
$sql$, targetTable);
execute sql;

View File

@ -223,6 +223,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
}
@Test
// TODO.impl: For unknown reason, this test fails in about 50%, not finding the uuid (404), maybe no SELECT permission?
void projectAdmin_canGetRelatedBookingItem() {
context.define("superuser-alex@hostsharing.net");
final var givenBookingItemUuid = bookingItemRepo.findByCaption("separate ManagedServer").stream()
@ -233,7 +234,7 @@ class HsBookingItemControllerAcceptanceTest extends ContextBasedTestWithCleanup
RestAssured // @formatter:off
.given()
.header("current-user", "superuser-alex@hostsharing.net")
hsh-michaelhoennig marked this conversation as resolved
Review

assumed-roles + "admin"

assumed-roles + "admin"
.header("assumend-roles", "hs_booking_project#D-1000212-D-1000212defaultproject")
.header("assumed-roles", "hs_booking_project#D-1000313-D-1000313defaultproject:ADMIN")
.port(port)
.when()
.get("http://localhost/api/hs/booking/items/" + givenBookingItemUuid)

View File

@ -20,6 +20,7 @@ import java.util.Map;
import java.util.UUID;
import static java.util.Map.entry;
import static net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType.CLOUD_SERVER;
import static net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAssetType.MANAGED_SERVER;
import static net.hostsharing.hsadminng.rbac.test.JsonMatcher.lenientlyEquals;
import static org.assertj.core.api.Assertions.assertThat;
@ -406,8 +407,8 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
@Test
void globalAdmin_canDeleteArbitraryAsset() {
context.define("superuser-alex@hostsharing.net");
hsh-michaelhoennig marked this conversation as resolved Outdated

überprüfen

überprüfen
final var givenAsset = givenSomeTemporaryHostingAsset("2002", MANAGED_SERVER,
config("CPUs", 4), config("RAM", 100), config("HDD", 100), config("Traffic", 2000));
final var givenAsset = givenSomeTemporaryHostingAsset("1002", MANAGED_SERVER,
config("monit_max_ssd_usage", 80), config("monit_max_hdd_usage", 90), config("monit_max_cpu_usage", 90), config("monit_max_ram_usage", 70));
RestAssured // @formatter:off
.given()
@ -425,8 +426,8 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
@Test
void normalUser_canNotDeleteUnrelatedAsset() {
context.define("superuser-alex@hostsharing.net");
hsh-michaelhoennig marked this conversation as resolved Outdated

überprüfen

überprüfen
final var givenAsset = givenSomeTemporaryHostingAsset("2003", MANAGED_SERVER,
config("CPUs", 4), config("RAM", 100), config("HDD", 100), config("Traffic", 2000));
final var givenAsset = givenSomeTemporaryHostingAsset("1003", MANAGED_SERVER,
config("monit_max_ssd_usage", 80), config("monit_max_hdd_usage", 90), config("monit_max_cpu_usage", 90), config("monit_max_ram_usage", 70));
RestAssured // @formatter:off
.given()