Skip to content

Commit

Permalink
IS-1693: Skip invalid pdf vedlegg
Browse files Browse the repository at this point in the history
  • Loading branch information
geir-waagboe committed Oct 20, 2023
1 parent f04aa00 commit 78c73c3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/test/kotlin/no/nav/syfo/api/VedleggSystemApiSpek.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,30 @@ class VedleggSystemApiSpek : Spek({
response.status() shouldBeEqualTo HttpStatusCode.OK
}
}
it("should only get valid vedlegg") {
every { incomingMessage.text } returns(
getFileAsString("src/test/resources/dialogmelding_dialog_notat_vedlegg.xml")
.replace(
"<MimeType>image/jpeg</MimeType>",
"<MimeType>application/pdf</MimeType>",)
.replace(
"<MsgId>37340D30-FE14-42B5-985F-A8FF8FFA0CB5</MsgId>",
"<MsgId>$msgId</MsgId>",
)
)
runBlocking {
blockingApplicationRunner.processMessage(incomingMessage)
}
with(
handleRequest(HttpMethod.Get, url) {
addHeader(HttpHeaders.Authorization, bearerHeader(validToken))
}
) {
val vedleggListe = objectMapper.readValue<List<VedleggDTO>>(response.content!!)
vedleggListe.size shouldBeEqualTo 1
response.status() shouldBeEqualTo HttpStatusCode.OK
}
}
it("should get plenty of vedlegg for msgId") {
every { incomingMessage.text } returns(
getFileAsString("src/test/resources/dialogmelding_dialog_notat_veldig_mange_vedlegg.xml")
Expand Down

0 comments on commit 78c73c3

Please sign in to comment.