Skip to content

Commit 2a88acc

Browse files
committed
PI-2517 - add openapi specs via call to dev service
1 parent be42db4 commit 2a88acc

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

Dockerfile.prism

+11-4
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,23 @@ FROM stoplight/prism:5
33

44
RUN apk add --no-cache curl jq
55
RUN npm install -g @apidevtools/swagger-cli
6-
COPY src/main/kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi/prismMocks /prismMocks
7-
ADD https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/external-api-and-delius/api-docs.json /prismMocks/ndelius.json
8-
ADD https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/effective-proposal-framework-and-delius/api-docs.json /prismMocks/probation-integration-epf.json
6+
RUN mkdir /prismMocks
7+
8+
ADD https://manage-adjudications-api-dev.hmpps.service.justice.gov.uk/v3/api-docs /prismMocks/adjudications.json
9+
ADD https://assess-risks-and-needs-dev.hmpps.service.justice.gov.uk/v3/api-docs /prismMocks/assess-risks-and-needs.json
10+
ADD https://dev.offender-case-notes.service.justice.gov.uk/v3/api-docs /prismMocks/case-notes.json
11+
ADD https://create-and-vary-a-licence-api-dev.hmpps.service.justice.gov.uk/v3/api-docs /prismMocks/create-and-vary-a-licence.json
912
ADD https://dev.moic.service.justice.gov.uk/v3/api-docs.json /prismMocks/manage-pom-case-api.json
13+
ADD https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/external-api-and-delius/api-docs.json /prismMocks/ndelius.json
1014
ADD https://prison-api-dev.prison.service.justice.gov.uk/v3/api-docs /prismMocks/prison-api.json
1115
ADD https://probation-offender-search-dev.hmpps.service.justice.gov.uk/v3/api-docs /prismMocks/probation-offender-search.json
12-
16+
ADD https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/effective-proposal-framework-and-delius/api-docs.json /prismMocks/probation-integration-epf.json
1317
ADD https://prisoner-search-dev.prison.service.justice.gov.uk/v3/api-docs /tmp/prisoner-offender-search-tmp.json
18+
1419
RUN jq 'del(.components.schemas.Query.properties.subQueries)' /tmp/prisoner-offender-search-tmp.json > prisoner-offender-search-tmp1.json
1520
RUN swagger-cli bundle -r -o /prismMocks/prisoner-offender-search.json prisoner-offender-search-tmp1.json
21+
22+
RUN sed -i 's/\*\/\*/application\/json/g' /prismMocks/adjudications.json
1623
RUN sed -i 's/\*\/\*/application\/json/g' /prismMocks/prisoner-offender-search.json
1724

1825
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

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ services:
3333
dockerfile: Dockerfile.prism
3434
container_name: prism
3535
healthcheck:
36-
test: 'curl -H "Authorization: Bearer abc" http://127.0.0.1:4017/prisoner/A1234AL &&
37-
curl -H "Authorization: Bearer abc" http://127.0.0.1:4018/case-details/officiis/1134670863'
36+
test: 'curl -H "Authorization: Bearer abc" -f http://localhost:4010/reported-adjudications/hearings?hearingDate=1910-06-03 &&
37+
curl -H "Authorization: Bearer abc" -f http://127.0.0.1:4017/prisoner/A1234AL &&
38+
curl -H "Authorization: Bearer abc" -f http://127.0.0.1:4018/case-details/officiis/1134670863'
3839
ports:
3940
- '4010:4010'
4041
- '4011:4011'

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

+12
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,16 @@ internal class PersonIntegrationTest : IntegrationTestBase() {
6262
),
6363
)
6464
}
65+
66+
@Test
67+
fun `returns person cell location if in prison`() {
68+
mockMvc.perform(
69+
get("$basePath/$encodedHmppsId/cell-location").headers(getAuthHeader()),
70+
)
71+
.andExpect(status().isOk)
72+
.andDo(print())
73+
.andExpect(content().json("""
74+
{"data":{"prisonCode":"MDI","prisonName":"HMP Leeds","cell":"A-1-002"}}
75+
"""))
76+
}
6577
}

0 commit comments

Comments
 (0)