From 78c73c3c4826774364c5e1f235a1195fdcf6bc26 Mon Sep 17 00:00:00 2001 From: geir-waagboe Date: Fri, 20 Oct 2023 09:52:18 +0200 Subject: [PATCH] IS-1693: Skip invalid pdf vedlegg --- .../no/nav/syfo/api/VedleggSystemApiSpek.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/test/kotlin/no/nav/syfo/api/VedleggSystemApiSpek.kt b/src/test/kotlin/no/nav/syfo/api/VedleggSystemApiSpek.kt index 18baf00b..e1c3b1a8 100644 --- a/src/test/kotlin/no/nav/syfo/api/VedleggSystemApiSpek.kt +++ b/src/test/kotlin/no/nav/syfo/api/VedleggSystemApiSpek.kt @@ -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( + "image/jpeg", + "application/pdf",) + .replace( + "37340D30-FE14-42B5-985F-A8FF8FFA0CB5", + "$msgId", + ) + ) + runBlocking { + blockingApplicationRunner.processMessage(incomingMessage) + } + with( + handleRequest(HttpMethod.Get, url) { + addHeader(HttpHeaders.Authorization, bearerHeader(validToken)) + } + ) { + val vedleggListe = objectMapper.readValue>(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")