generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* PI-1834: Add team addresses to responsible com endpoint
- Loading branch information
Showing
11 changed files
with
87 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,13 +12,11 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get | |
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post | ||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status | ||
import uk.gov.justice.digital.hmpps.api.model.* | ||
import uk.gov.justice.digital.hmpps.data.generator.OfficeLocationGenerator | ||
import uk.gov.justice.digital.hmpps.data.generator.PersonGenerator | ||
import uk.gov.justice.digital.hmpps.data.generator.ProviderGenerator | ||
import uk.gov.justice.digital.hmpps.data.generator.StaffGenerator | ||
import uk.gov.justice.digital.hmpps.service.asManager | ||
import uk.gov.justice.digital.hmpps.service.asPDUHead | ||
import uk.gov.justice.digital.hmpps.service.asStaff | ||
import uk.gov.justice.digital.hmpps.service.asStaffName | ||
import uk.gov.justice.digital.hmpps.service.* | ||
import uk.gov.justice.digital.hmpps.test.MockMvcExtensions.contentAsJson | ||
import uk.gov.justice.digital.hmpps.test.MockMvcExtensions.withJson | ||
import uk.gov.justice.digital.hmpps.test.MockMvcExtensions.withToken | ||
|
@@ -39,14 +37,36 @@ internal class IntegrationTest { | |
.andExpect(status().isOk) | ||
.andReturn().response.contentAsJson<Manager>() | ||
|
||
val expectedAddresses: List<OfficeAddress> = listOf( | ||
OfficeLocationGenerator.LOCATION_BRK_1.asAddress(), | ||
OfficeLocationGenerator.LOCATION_BRK_2.asAddress() | ||
) | ||
|
||
assertThat( | ||
manager, | ||
equalTo( | ||
PersonGenerator.DEFAULT_CM.asManager().copy(username = "john-smith", email = "[email protected]") | ||
PersonGenerator.DEFAULT_CM.asManager().copy( | ||
username = "john-smith", email = "[email protected]", | ||
team = ProviderGenerator.DEFAULT_TEAM.asTeam(teamAddresses = expectedAddresses) | ||
) | ||
) | ||
) | ||
} | ||
|
||
@Test | ||
fun `returns only active team office locations`() { | ||
val crn = PersonGenerator.DEFAULT_PERSON.crn | ||
|
||
val manager = mockMvc | ||
.perform(get("/probation-case/$crn/responsible-community-manager").withToken()) | ||
.andExpect(status().isOk) | ||
.andReturn().response.contentAsJson<Manager>() | ||
assertThat( | ||
manager.team.addresses?.size, | ||
equalTo(2) | ||
) | ||
} | ||
|
||
@Test | ||
fun `returns 404 if no crn or community officer`() { | ||
mockMvc.perform( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters