Skip to content

Commit

Permalink
VIH-10086 add judicial office holders (#1295)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaed-parkar authored Nov 15, 2023
1 parent 8b205d7 commit f0dd2a8
Show file tree
Hide file tree
Showing 121 changed files with 3,212 additions and 740 deletions.
6 changes: 3 additions & 3 deletions AdminWebsite/AdminWebsite.IntegrationTests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
},
"BookingsApi.Client": {
"type": "Transitive",
"resolved": "1.47.15",
"contentHash": "sd5lILWV3aiku/U/tFu16n7Fi9wAELGP0rVpLhaDFq3YzwxEL8JshbN0BUin3F/QZM3T8+DsnMKbMDcU449cqA==",
"resolved": "1.49.10",
"contentHash": "oXH1qyRZhkrbVbdZB7QsO8O0a/6SRCrB71Hb0leiRNUGr/xb0IYdqpaTr6imTeo6zimGxieMiu9uKMsnFpVA/w==",
"dependencies": {
"Microsoft.AspNetCore.Mvc.Core": "2.2.5"
}
Expand Down Expand Up @@ -2101,7 +2101,7 @@
"type": "Project",
"dependencies": {
"AspNetCore.HealthChecks.Uris": "[6.0.3, )",
"BookingsApi.Client": "[1.47.15, )",
"BookingsApi.Client": "[1.49.10, )",
"FluentValidation.AspNetCore": "[10.4.0, )",
"LaunchDarkly.ServerSdk": "[7.0.3, )",
"MicroElements.Swashbuckle.FluentValidation": "[5.7.0, )",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ public async Task Should_book_hearing_for_multi_day()
}

[Test]
public async Task Should_book_hearing_with_reference_data_flag_on()
public async Task Should_book_hearing_with_use_v2_api_flag_on()
{
// Arrange
_mocker.Mock<IFeatureToggles>().Setup(x => x.ReferenceDataToggle()).Returns(true);
_mocker.Mock<IFeatureToggles>().Setup(x => x.UseV2Api()).Returns(true);
var bookingDetails = InitHearingForV2Test();

var bookingRequest = new BookHearingRequest
Expand All @@ -259,7 +259,6 @@ public async Task Should_book_hearing_with_reference_data_flag_on()
.WithParticipant("Individual", "[email protected]")
.WithParticipant("Individual", "[email protected]")
.WithParticipant("Judicial Office Holder", "[email protected]")
.WithParticipant("Staff Member","[email protected]")
.WithParticipant("Judge", "[email protected]");
_mocker.Mock<IBookingsApiClient>().Setup(x => x.BookNewHearingWithCodeAsync(It.IsAny<BookNewHearingRequestV2>()))
.ReturnsAsync(hearingDetailsResponse);
Expand Down Expand Up @@ -415,65 +414,76 @@ private BookingDetailsRequest InitHearingForV2Test()
{
Participants = new List<ParticipantRequest>
{
new ()
new()
{
ContactEmail = "[email protected]",
HearingRoleCode = "APPL", DisplayName = "display name1",
FirstName = "fname", MiddleNames = "", LastName = "lname1", Username = "[email protected]",
OrganisationName = "", Representee = "", TelephoneNumber = ""
},
new ()
new()
{
ContactEmail = "[email protected]",
HearingRoleCode = "APPL", DisplayName = "display name2",
FirstName = "fname2", MiddleNames = "", LastName = "lname2", OrganisationName = "",
Representee = "", TelephoneNumber = "", Username = "[email protected]"
},
new ()
new()
{
ContactEmail = "[email protected]",
HearingRoleCode = "APPL", DisplayName = "display name3",
FirstName = "fname3", MiddleNames = "", LastName = "lname3", OrganisationName = "",
Representee = "", TelephoneNumber = "", Username = "[email protected]"
},
new ()
new()
{
ContactEmail = "[email protected]",
HearingRoleCode = "PANL", DisplayName = "display name4",
FirstName = "fname4", MiddleNames = "", LastName = "lname4", OrganisationName = "",
Representee = "", TelephoneNumber = "", Username = "[email protected]"
},
new ()
new()
{
ContactEmail = "[email protected]",
HearingRoleCode = "INTP", DisplayName = "display name2",
FirstName = "fname5", MiddleNames = "", LastName = "lname5", OrganisationName = "",
Representee = "", TelephoneNumber = "", Username = "[email protected]"
}
},
JudiciaryParticipants = new List<JudiciaryParticipantRequest>()
{
new()
{
DisplayName = "display name4", PersonalCode = "12345678", Role = "PanelMember"
},
new ()
new()
{
ContactEmail = "[email protected]",
HearingRoleCode = "JUDG", DisplayName = "Judge Fudge",
FirstName = "Jack", MiddleNames = "", LastName = "Fudge",
Username = "[email protected]", OrganisationName = "", Representee = "",
TelephoneNumber = ""
DisplayName = "Judge Fudge", PersonalCode = "12345678", Role = "Judge"
}
},
Endpoints = new List<EndpointRequest>
{
new ()
new()
{DisplayName = "displayname1", DefenceAdvocateContactEmail = "[email protected]"},
new ()
new()
{DisplayName = "displayname2", DefenceAdvocateContactEmail = "[email protected]"},
},
LinkedParticipants = new List<LinkedParticipantRequest>
{
new () { ParticipantContactEmail = "[email protected]", LinkedParticipantContactEmail = "[email protected]", Type = LinkedParticipantType.Interpreter },
new () { ParticipantContactEmail = "[email protected]", LinkedParticipantContactEmail = "[email protected]", Type = LinkedParticipantType.Interpreter }
new()
{
ParticipantContactEmail = "[email protected]",
LinkedParticipantContactEmail = "[email protected]", Type = LinkedParticipantType.Interpreter
},
new()
{
ParticipantContactEmail = "[email protected]",
LinkedParticipantContactEmail = "[email protected]", Type = LinkedParticipantType.Interpreter
}
},
Cases = new List<CaseRequest>
{
new ()
new()
{
Name = "Case1", Number = "001", IsLeadCase = true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using AdminWebsite.UnitTests.Helper;
using BookingsApi.Client;
using BookingsApi.Contract.V1.Requests;
using BookingsApi.Contract.V1.Requests.Enums;
using BookingsApi.Contract.V1.Responses;
using BookingsApi.Contract.V2.Enums;
using BookingsApi.Contract.V2.Requests;
Expand All @@ -32,6 +33,7 @@
using BookingStatus = BookingsApi.Contract.V1.Enums.BookingStatus;
using CaseResponse = BookingsApi.Contract.V1.Responses.CaseResponse;
using EndpointResponse = BookingsApi.Contract.V1.Responses.EndpointResponse;
using JudiciaryParticipantRequest = AdminWebsite.Contracts.Requests.JudiciaryParticipantRequest;
using LinkedParticipantResponse = BookingsApi.Contract.V1.Responses.LinkedParticipantResponse;
using LinkedParticipantType = BookingsApi.Contract.V1.Enums.LinkedParticipantType;

Expand Down Expand Up @@ -358,6 +360,11 @@ public void Setup()
Pin = "pin",
Sip = "sip"
}
},
JudiciaryParticipants = new List<JudiciaryParticipantResponse>()
{
new (){FullName = "Judge Fudge", FirstName = "John", LastName = "Doe", HearingRoleCode = JudiciaryParticipantHearingRoleCode.Judge, PersonalCode = "1234"},
new (){FullName = "Jane Doe", FirstName = "Jane", LastName = "Doe", HearingRoleCode = JudiciaryParticipantHearingRoleCode.PanelMember, PersonalCode = "4567"}
}
};
}
Expand Down Expand Up @@ -570,7 +577,7 @@ public async Task Should_return_updated_hearing()
[Test]
public async Task Should_return_updated_hearingV2()
{
_featureToggle.Setup(e => e.ReferenceDataToggle()).Returns(true);
_featureToggle.Setup(e => e.UseV2Api()).Returns(true);
var updatedHearing = _v2HearingDetailsResponse;
_bookingsApiClient.SetupSequence(x => x.GetHearingDetailsByIdV2Async(It.IsAny<Guid>()))
.ReturnsAsync(updatedHearing)
Expand Down Expand Up @@ -605,15 +612,36 @@ public async Task Should_return_updated_hearingV2()
LinkedParticipantContactEmail = "[email protected]",
Type = AdminWebsite.Contracts.Enums.LinkedParticipantType.Interpreter
}
}
},
});
_addNewParticipantRequest.JudiciaryParticipants = new List<JudiciaryParticipantRequest>()
{
new()
{
PersonalCode = "4567", DisplayName = "Jane Doe 2", Role = JudiciaryParticipantHearingRoleCode.PanelMember.ToString()
},
new()
{
PersonalCode = "5678", DisplayName = "New Judge Fudge", Role = JudiciaryParticipantHearingRoleCode.Judge.ToString()
}
};
var result = await _controller.EditHearing(_validId, _addNewParticipantRequest);
var hearing = (AdminWebsite.Contracts.Responses.HearingDetailsResponse)((OkObjectResult)result.Result).Value;
hearing.Id.Should().Be(updatedHearing.Id);
_bookingsApiClient.Verify(x => x.UpdateHearingDetails2Async(It.IsAny<Guid>(),
It.Is<UpdateHearingRequestV2>(u =>
!u.Cases.IsNullOrEmpty())),
Times.Once);

_bookingsApiClient.Verify(x => x.RemoveJudiciaryParticipantFromHearingAsync(hearing.Id, "1234"),
Times.Once);

_bookingsApiClient.Verify(x => x.UpdateJudiciaryParticipantAsync(hearing.Id, "4567", It.IsAny<UpdateJudiciaryParticipantRequest>()),
Times.Once);

_bookingsApiClient.Verify(
x => x.AddJudiciaryParticipantsToHearingAsync(hearing.Id,
It.IsAny<IEnumerable<BookingsApi.Contract.V1.Requests.JudiciaryParticipantRequest>>()), Times.Once);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public async Task Should_return_ok_status_if_hearing_id_is_valid()
public async Task Should_return_ok_status_if_hearing_id_is_validV2()
{
// Arrange
_featureToggle.Setup(e => e.ReferenceDataToggle()).Returns(true);
_featureToggle.Setup(e => e.UseV2Api()).Returns(true);
_mocker.Mock<IBookingsApiClient>().Setup(x =>
x.GetHearingDetailsByIdV2Async(It.IsAny<Guid>())).ReturnsAsync(_vhExistingHearingV2);

Expand Down
Loading

0 comments on commit f0dd2a8

Please sign in to comment.