Skip to content

Commit

Permalink
Merge pull request #1200 from catenax-ng/chore/726-add-preauthorize-t…
Browse files Browse the repository at this point in the history
…o-dashboard-controller

chore(dashboard): 726 added test
  • Loading branch information
ds-mmaul authored Apr 22, 2024
2 parents 8a3b206 + 904981e commit 929d13d
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
package org.eclipse.tractusx.traceability.integration.assets;

import io.restassured.http.ContentType;
import notification.request.NotificationSeverityRequest;
import notification.request.NotificationTypeRequest;
import notification.request.StartNotificationRequest;
import org.eclipse.tractusx.traceability.assets.domain.base.model.Owner;
import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.model.AssetAsBuiltEntity;
import org.eclipse.tractusx.traceability.assets.infrastructure.asbuilt.repository.JpaAssetAsBuiltRepository;
Expand All @@ -36,9 +39,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.testcontainers.shaded.com.fasterxml.jackson.core.JsonProcessingException;
import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper;
import notification.request.NotificationSeverityRequest;
import notification.request.NotificationTypeRequest;
import notification.request.StartNotificationRequest;

import java.util.List;
import java.util.stream.Stream;
Expand Down Expand Up @@ -155,6 +155,20 @@ void givenNoRoles_whenGetDashboard_thenReturn401() throws JoseException {
.then().statusCode(401);
}

@Test
void givenNoRoles_whenGetDashboard_thenReturn403() throws JoseException {
// given
assetsSupport.defaultAssetsStored();

// when/then
given()
.header(oAuth2Support.jwtAuthorizationWithNoRole())
.contentType(ContentType.JSON)
.log().all()
.when().get("/api/dashboard")
.then().statusCode(403);
}

@Test
void givenPendingInvestigation_whenGetDashboard_thenReturnPendingInvestigation() throws JoseException, JsonProcessingException {
// given
Expand Down

0 comments on commit 929d13d

Please sign in to comment.