|
| 1 | +package uk.gov.justice.digital.hmpps.hmppsintegrationapi.smoke.person |
| 2 | + |
| 3 | +import io.kotest.core.spec.style.DescribeSpec |
| 4 | +import io.kotest.matchers.shouldBe |
| 5 | +import io.kotest.matchers.string.shouldContain |
| 6 | +import org.springframework.http.HttpStatus |
| 7 | +import uk.gov.justice.digital.hmpps.hmppsintegrationapi.extensions.removeWhitespaceAndNewlines |
| 8 | +import uk.gov.justice.digital.hmpps.hmppsintegrationapi.helpers.IntegrationAPIHttpClient |
| 9 | +import java.net.URLEncoder |
| 10 | +import java.nio.charset.StandardCharsets |
| 11 | + |
| 12 | +class RiskManagementSmokeTest : DescribeSpec( |
| 13 | + { |
| 14 | + val basePath = "v1/persons" |
| 15 | + val httpClient = IntegrationAPIHttpClient() |
| 16 | + val hmppsId = "2004/13116M" |
| 17 | + val tailPath = "risk-management-plan" |
| 18 | + val encodedHmppsId = URLEncoder.encode(hmppsId, StandardCharsets.UTF_8) |
| 19 | + |
| 20 | + it("returns a list of risk management plans using crn / hmppsId as search parameters") { |
| 21 | + |
| 22 | + val response = httpClient.performAuthorised("$basePath/$encodedHmppsId/$tailPath") |
| 23 | + |
| 24 | + response.statusCode().shouldBe(HttpStatus.OK.value()) |
| 25 | + response.body().shouldContain("\"data\":[") |
| 26 | + response.body().shouldContain( |
| 27 | + """ |
| 28 | + "assessmentStatus": "string", |
| 29 | + "assessmentType": "string", |
| 30 | + "initiationDate": "2024-05-04T01:04:20", |
| 31 | + "assessmentStatus": "string", |
| 32 | + "assessmentType": "string", |
| 33 | + """.removeWhitespaceAndNewlines(), |
| 34 | + ) |
| 35 | + } |
| 36 | + } |
| 37 | +) |
0 commit comments