Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(dashboard): 726 added test #1200

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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