From 87d09cd3954de90825b46ca7aff2833a69ef8c51 Mon Sep 17 00:00:00 2001 From: Martin Weise <martin.weise@tuwien.ac.at> Date: Wed, 15 Jan 2025 17:29:15 +0100 Subject: [PATCH] WIP Signed-off-by: Martin Weise <martin.weise@tuwien.ac.at> --- .../at/tuwien/endpoint/SubsetEndpointUnitTest.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/SubsetEndpointUnitTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/SubsetEndpointUnitTest.java index 3904d83e13..83d660ef5e 100644 --- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/SubsetEndpointUnitTest.java +++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/SubsetEndpointUnitTest.java @@ -141,7 +141,7 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest { .thenReturn(DATABASE_3_PRIVILEGED_DTO); /* test */ - assertThrows(DatabaseUnavailableException.class, () -> { + assertThrows(NotAllowedException.class, () -> { generic_list(DATABASE_3_ID, DATABASE_3_PRIVILEGED_DTO, USER_4_PRINCIPAL); }); } @@ -317,19 +317,17 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest { } @Test - @WithMockUser(username = USER_3_USERNAME) - public void findById_publicDataAndPrivateSchemaNoRole_fails() throws DatabaseNotFoundException, SQLException, - RemoteUnavailableException, MetadataServiceException, UserNotFoundException, QueryNotFoundException { + @WithMockUser(username = USER_4_USERNAME) + public void findById_publicDataAndPrivateSchemaNoRole_fails() throws DatabaseNotFoundException, + RemoteUnavailableException, MetadataServiceException { /* mock */ when(credentialService.getDatabase(DATABASE_3_ID)) .thenReturn(DATABASE_3_PRIVILEGED_DTO); - when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID)) - .thenReturn(QUERY_5_DTO); /* test */ assertThrows(NotAllowedException.class, () -> { - generic_findById(DATABASE_3_ID, QUERY_5_ID, "application/json", null, USER_3_PRINCIPAL); + generic_findById(DATABASE_3_ID, QUERY_5_ID, "application/json", null, USER_4_PRINCIPAL); }); } -- GitLab