diff --git a/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/config/SecurityConfig.kt b/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/config/SecurityConfig.kt index 8a062eb..8fdd169 100644 --- a/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/config/SecurityConfig.kt +++ b/legalconsenthub-backend/src/main/kotlin/com/betriebsratkanzlei/legalconsenthub/config/SecurityConfig.kt @@ -3,6 +3,7 @@ package com.betriebsratkanzlei.legalconsenthub.config import com.betriebsratkanzlei.legalconsenthub.security.CustomJwtAuthenticationConverter import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import org.springframework.context.annotation.Profile import org.springframework.core.annotation.Order import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity import org.springframework.security.config.annotation.web.builders.HttpSecurity @@ -13,6 +14,7 @@ import org.springframework.security.web.SecurityFilterChain @Configuration @EnableWebSecurity @EnableMethodSecurity +@Profile("!test") class SecurityConfig { @Bean @Order(1) diff --git a/legalconsenthub-backend/src/test/kotlin/com/betriebsratkanzlei/legalconsenthub/LegalconsenthubApplicationTests.kt b/legalconsenthub-backend/src/test/kotlin/com/betriebsratkanzlei/legalconsenthub/LegalconsenthubApplicationTests.kt index 22d18cc..75a3246 100644 --- a/legalconsenthub-backend/src/test/kotlin/com/betriebsratkanzlei/legalconsenthub/LegalconsenthubApplicationTests.kt +++ b/legalconsenthub-backend/src/test/kotlin/com/betriebsratkanzlei/legalconsenthub/LegalconsenthubApplicationTests.kt @@ -2,8 +2,10 @@ package com.betriebsratkanzlei.legalconsenthub import org.junit.jupiter.api.Test import org.springframework.boot.test.context.SpringBootTest +import org.springframework.test.context.ActiveProfiles @SpringBootTest +@ActiveProfiles("test") class LegalconsenthubApplicationTests { @Test fun contextLoads() { diff --git a/legalconsenthub-backend/src/test/resources/application-test.yaml b/legalconsenthub-backend/src/test/resources/application-test.yaml new file mode 100644 index 0000000..4267ea7 --- /dev/null +++ b/legalconsenthub-backend/src/test/resources/application-test.yaml @@ -0,0 +1,33 @@ +spring: + application: + name: legalconsenthub-test + + autoconfigure: + exclude: + - org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration + + datasource: + url: jdbc:h2:mem:testdb + username: sa + password: + driver-class-name: org.h2.Driver + + jpa: + database-platform: org.hibernate.dialect.H2Dialect + hibernate: + ddl-auto: create-drop + show-sql: false + + liquibase: + enabled: false + + sql: + init: + platform: h2 + +logging: + level: + com.betriebsratkanzlei.legalconsenthub: DEBUG + org.springframework.security: WARN + org.springframework.web: WARN +