@@ -1131,8 +1131,13 @@ void KeysetSetNewNullAllowedSites(Vertx vertx, VertxTestContext testContext) {
11311131 post (vertx , testContext , "api/sharing/keyset" , body , response -> {
11321132 assertEquals (200 , response .statusCode ());
11331133
1134- AdminKeyset expected = new AdminKeyset (2 , 1 , "test" , null , Instant .now ().getEpochSecond (), true , true , new HashSet <>());
1135- assertEquals (null , response .bodyAsJsonObject ().getJsonArray ("allowed_sites" ));
1134+ // Next keyset id is max(existing ids, 3) + 1 => 4 when only keyset 1 exists
1135+ int newKeysetId = 4 ;
1136+ AdminKeyset expected = new AdminKeyset (newKeysetId , 3 , "" , new HashSet <>(), Instant .now ().getEpochSecond (), true , true , Set .of (ClientType .DSP ));
1137+ compareKeysetListToResult (expected , response .bodyAsJsonObject ().getJsonArray ("allowed_sites" ));
1138+ compareKeysetTypeListToResult (expected , response .bodyAsJsonObject ().getJsonArray ("allowed_types" ));
1139+ assertEquals (expected .getAllowedSites (), keysets .get (newKeysetId ).getAllowedSites ());
1140+ assertEquals (expected .getAllowedTypes (), keysets .get (newKeysetId ).getAllowedTypes ());
11361141
11371142 testContext .completeNow ();
11381143 });
@@ -1158,8 +1163,12 @@ void KeysetSetNewExplicitlyNullAllowedSites(Vertx vertx, VertxTestContext testCo
11581163 post (vertx , testContext , "api/sharing/keyset" , body , response -> {
11591164 assertEquals (200 , response .statusCode ());
11601165
1161- AdminKeyset expected = new AdminKeyset (2 , 1 , "test" , null , Instant .now ().getEpochSecond (), true , true , new HashSet <>());
1162- assertEquals (null , response .bodyAsJsonObject ().getJsonArray ("allowed_sites" ));
1166+ int newKeysetId = 4 ;
1167+ AdminKeyset expected = new AdminKeyset (newKeysetId , 3 , "" , new HashSet <>(), Instant .now ().getEpochSecond (), true , true , Set .of (ClientType .DSP ));
1168+ compareKeysetListToResult (expected , response .bodyAsJsonObject ().getJsonArray ("allowed_sites" ));
1169+ compareKeysetTypeListToResult (expected , response .bodyAsJsonObject ().getJsonArray ("allowed_types" ));
1170+ assertEquals (expected .getAllowedSites (), keysets .get (newKeysetId ).getAllowedSites ());
1171+ assertEquals (expected .getAllowedTypes (), keysets .get (newKeysetId ).getAllowedTypes ());
11631172
11641173 testContext .completeNow ();
11651174 });
@@ -1184,8 +1193,9 @@ void KeysetSetUpdateNullAllowedSites(Vertx vertx, VertxTestContext testContext)
11841193 post (vertx , testContext , "api/sharing/keyset" , body , response -> {
11851194 assertEquals (200 , response .statusCode ());
11861195
1187- AdminKeyset expected = new AdminKeyset (1 , 5 , "test" , null , Instant .now ().getEpochSecond (), true , true , new HashSet <>( ));
1196+ AdminKeyset expected = new AdminKeyset (1 , 5 , "test" , null , Instant .now ().getEpochSecond (), true , true , Set . of ( ClientType . DSP ));
11881197 assertEquals (null , response .bodyAsJsonObject ().getJsonArray ("allowed_sites" ));
1198+ compareKeysetTypeListToResult (expected , response .bodyAsJsonObject ().getJsonArray ("allowed_types" ));
11891199
11901200 testContext .completeNow ();
11911201 });
@@ -1211,8 +1221,9 @@ void KeysetSetUpdateExplicitlyNullAllowedSites(Vertx vertx, VertxTestContext tes
12111221 post (vertx , testContext , "api/sharing/keyset" , body , response -> {
12121222 assertEquals (200 , response .statusCode ());
12131223
1214- AdminKeyset expected = new AdminKeyset (1 , 5 , "test" , null , Instant .now ().getEpochSecond (), true , true , new HashSet <>( ));
1224+ AdminKeyset expected = new AdminKeyset (1 , 5 , "test" , null , Instant .now ().getEpochSecond (), true , true , Set . of ( ClientType . DSP ));
12151225 assertEquals (null , response .bodyAsJsonObject ().getJsonArray ("allowed_sites" ));
1226+ compareKeysetTypeListToResult (expected , response .bodyAsJsonObject ().getJsonArray ("allowed_types" ));
12161227
12171228 testContext .completeNow ();
12181229 });
0 commit comments