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
- Loading branch information
1 parent
2d08a04
commit 036a93a
Showing
3 changed files
with
38 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,6 +100,17 @@ internal class IntegrationTest { | |
.andExpect(jsonPath("$.telephoneNumber", equalTo("10101010101"))) | ||
} | ||
|
||
@Test | ||
fun `username is case-insensitive`() { | ||
val username = StaffGenerator.DEFAULT_STAFF_USER.username.uppercase() | ||
mockMvc | ||
.perform(get("/staff/$username").withToken()) | ||
.andExpect(status().isOk) | ||
.andExpect(jsonPath("$.username", equalTo("john-smith"))) | ||
.andExpect(jsonPath("$.email", equalTo("[email protected]"))) | ||
.andExpect(jsonPath("$.telephoneNumber", equalTo("10101010101"))) | ||
} | ||
|
||
@Test | ||
fun `returns pdu heads`() { | ||
val boroughCode = ProviderGenerator.DEFAULT_BOROUGH.code | ||
|
@@ -140,6 +151,29 @@ internal class IntegrationTest { | |
) | ||
} | ||
|
||
@Test | ||
fun `usernames are case-insensitive`() { | ||
val usernames = listOf( | ||
StaffGenerator.DEFAULT_PDUSTAFF_USER.username.uppercase(), | ||
StaffGenerator.DEFAULT_STAFF_USER.username.uppercase() | ||
) | ||
|
||
val staffNames = mockMvc | ||
.perform(post("/staff").withToken().withJson(usernames)) | ||
.andExpect(status().isOk) | ||
.andReturn().response.contentAsJson<List<StaffName>>() | ||
|
||
assertThat( | ||
staffNames, | ||
equalTo( | ||
listOf( | ||
StaffGenerator.PDUHEAD.asStaffName(), | ||
StaffGenerator.DEFAULT.asStaffName() | ||
) | ||
) | ||
) | ||
} | ||
|
||
@Test | ||
fun `returns staff by id `() { | ||
mockMvc | ||
|
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