Skip to content

Commit

Permalink
test(oppijanumero): fix tests from CI by not using spring beans
Browse files Browse the repository at this point in the history
  • Loading branch information
saku-koodari committed Dec 30, 2024
1 parent d95d25c commit a54dfde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
1 change: 0 additions & 1 deletion server/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ kitu.kotoutumiskoulutus.koealusta.scheduling.enabled=false
kitu.oppijanumero.password=${OPPIJANUMERO_PASSWORD}
kitu.oppijanumero.username=koto-rekisteri
kitu.oppijanumero.callerid=1.2.246.562.10.00000000001.koto-rekisteri
kitu.oppijanumero.service.url=
kitu.oppijanumero.service.use-mock-data=false

db-scheduler.enabled=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@ import HttpResponseMock
import com.fasterxml.jackson.databind.ObjectMapper
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.testcontainers.junit.jupiter.Testcontainers

@SpringBootTest
@Testcontainers
class OppijanumeroServiceTests {
@Test
fun `oppijanumero service returns identified user`(
@Autowired objectMapper: ObjectMapper,
) {
fun `oppijanumero service returns identified user`() {
// Facade
val response =
Result.success(
Expand All @@ -34,7 +27,7 @@ class OppijanumeroServiceTests {
OppijanumeroServiceImpl(
casAuthenticatedService =
CasAuthenticatedServiceMock(response),
objectMapper = objectMapper,
objectMapper = ObjectMapper(),
)
oppijanumeroService.serviceUrl = "http://localhost:8080/oppijanumero-service"

Expand All @@ -49,9 +42,7 @@ class OppijanumeroServiceTests {
}

@Test
fun `oppijanumero service returns unidentified user`(
@Autowired objectMapper: ObjectMapper,
) {
fun `oppijanumero service returns unidentified user`() {
// Facade
val response =
Result.success(
Expand All @@ -71,7 +62,7 @@ class OppijanumeroServiceTests {
OppijanumeroServiceImpl(
casAuthenticatedService =
CasAuthenticatedServiceMock(response),
objectMapper = objectMapper,
objectMapper = ObjectMapper(),
)
oppijanumeroService.serviceUrl = "http://localhost:8080/oppijanumero-service"

Expand All @@ -88,9 +79,7 @@ class OppijanumeroServiceTests {
}

@Test
fun `oppijanumero service returns error`(
@Autowired objectMapper: ObjectMapper,
) {
fun `oppijanumero service returns error`() {
// Facade
val response =
Result.success(
Expand All @@ -112,7 +101,7 @@ class OppijanumeroServiceTests {
OppijanumeroServiceImpl(
casAuthenticatedService =
CasAuthenticatedServiceMock(response),
objectMapper = objectMapper,
objectMapper = ObjectMapper(),
)
oppijanumeroService.serviceUrl = "http://localhost:8080/oppijanumero-service"

Expand Down

0 comments on commit a54dfde

Please sign in to comment.