Skip to content

Commit 288fd22

Browse files
committed
PI-2517 - update integration tests
1 parent 95c9ee7 commit 288fd22

File tree

6 files changed

+56
-1
lines changed

6 files changed

+56
-1
lines changed

Dockerfile.prism

+1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ RUN sed -i 's/\*\/\*/application\/json/g' /prismMocks/assess-risks-and-needs.jso
2525
RUN sed -i 's/\*\/\*/application\/json/g' /prismMocks/case-notes.json
2626
RUN sed -i 's/\*\/\*/application\/json/g' /prismMocks/prisoner-offender-search.json
2727

28+
COPY src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks/case-notes.json /prismMocks/case-notes.json
2829
ENTRYPOINT sh -c 'port=4010; for file in $(ls /prismMocks/*.json | sort); do node dist/index.js mock -p $port -h 0.0.0.0 $file & port=$((port + 1)); done; wait'

docker-compose.yml

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ services:
5555
- '4018:4018'
5656
- '4019:4019'
5757

58+
swagger-editor:
59+
image: swaggerapi/swagger-editor
60+
ports:
61+
- "8081:8080"
62+
5863
local-stack-aws:
5964
image: localstack/localstack:3.0
6065
container_name: local-stack-aws

src/main/resources/application-integration-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ services:
2727
create-and-vary-licence:
2828
base-url: http://localhost:4007
2929
case-notes:
30-
base-url: http://localhost:4008
30+
base-url: http://localhost:4012
3131
manage-pom-case-api:
3232
base-url: http://localhost:4009
3333

src/test/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/integration/IntegrationTestBase.kt

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ abstract class IntegrationTestBase {
2727
final val basePath = "/v1/persons"
2828
final val pnc = URLEncoder.encode("2004/13116M", StandardCharsets.UTF_8)
2929
final val nomsId = "G2996UX"
30+
final val crn = "ABC123"
3031

3132
companion object {
3233
private val hmppsAuthMockServer = HmppsAuthMockServer()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package uk.gov.justice.digital.hmpps.hmppsintegrationapi.integration.person
2+
3+
import org.junit.jupiter.api.Test
4+
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.content
5+
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status
6+
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.integration.IntegrationTestBase
7+
8+
class CaseNotesIntegrationTest : IntegrationTestBase() {
9+
10+
@Test
11+
fun `returns case notes for a person`() {
12+
callApi("$basePath/$crn/case-notes")
13+
.andExpect(status().isOk)
14+
.andExpect(content().json(getExpectedResponse("person-case-notes")))
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"data": [
3+
{
4+
"caseNoteId": "12311312",
5+
"offenderIdentifier": "A1234AA",
6+
"type": "KA",
7+
"typeDescription": "Key Worker",
8+
"subType": "KS",
9+
"subTypeDescription": "Key Worker Session",
10+
"creationDateTime": "2019-08-24T14:15:22",
11+
"occurrenceDateTime": "2019-08-24T14:15:22",
12+
"text": "This is some text",
13+
"locationId": "MDI",
14+
"sensitive": true,
15+
"amendments": [
16+
{
17+
"caseNoteAmendmentId": 123232,
18+
"creationDateTime": "2019-08-24T14:15:22",
19+
"additionalNoteText": "Some Additional Text"
20+
}
21+
]
22+
}
23+
],
24+
"pagination": {
25+
"isLastPage": true,
26+
"count": 1,
27+
"page": 1,
28+
"perPage": 10,
29+
"totalCount": 1,
30+
"totalPages": 1
31+
}
32+
}

0 commit comments

Comments
 (0)