|
| 1 | +package uk.gov.justice.digital.hmpps.hmppsintegrationapi.smoke.person |
| 2 | + |
| 3 | +import io.kotest.assertions.json.shouldEqualJson |
| 4 | +import io.kotest.core.spec.style.DescribeSpec |
| 5 | +import io.kotest.matchers.shouldBe |
| 6 | +import org.springframework.http.HttpStatus |
| 7 | +import uk.gov.justice.digital.hmpps.hmppsintegrationapi.helpers.IntegrationAPIHttpClient |
| 8 | +import java.net.URLEncoder |
| 9 | +import java.nio.charset.StandardCharsets |
| 10 | + |
| 11 | +class PersonResponsibleOfficerSmokeTest : DescribeSpec( |
| 12 | + { |
| 13 | + val hmppsId = "A1234AA" |
| 14 | + val encodedHmppsId = URLEncoder.encode(hmppsId, StandardCharsets.UTF_8) |
| 15 | + |
| 16 | + val basePath = "v1/persons/$encodedHmppsId/person-responsible-officer" |
| 17 | + val httpClient = IntegrationAPIHttpClient() |
| 18 | + |
| 19 | + it("returns the person responsible officer for a person") { |
| 20 | + val response = httpClient.performAuthorised(basePath) |
| 21 | + response.statusCode().shouldBe(HttpStatus.OK.value()) |
| 22 | + response.body().shouldEqualJson( |
| 23 | + """ |
| 24 | + "data": { |
| 25 | + "prisonOffenderManager": { |
| 26 | + "forename": "Paul", |
| 27 | + "surname": "Reds", |
| 28 | + "prison": { |
| 29 | + "code": "PrisonCode1" |
| 30 | + } |
| 31 | + }, |
| 32 | + "communityOffenderManager": { |
| 33 | + "name": { |
| 34 | + "forename": "Helen", |
| 35 | + "surname": "Miller" |
| 36 | + }, |
| 37 | + "email": "helenemail@email.com", |
| 38 | + "telephoneNumber": "0987654321", |
| 39 | + "team": { |
| 40 | + "code": "PrisonCode2", |
| 41 | + "description": "Description", |
| 42 | + "email": "email_again@email.com", |
| 43 | + "telephoneNumber": "01234567890" |
| 44 | + } |
| 45 | + } |
| 46 | + } |
| 47 | + """.trimIndent(), |
| 48 | + ) |
| 49 | + } |
| 50 | + }, |
| 51 | +) |
0 commit comments