Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker compose #1403

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
aa9112b
removed feature flag: Book_and_confirm, vho-work-allocation, notify-p…
marcogagliardi Jun 10, 2024
26aa1bf
removed notify-post-may-2023-templates
marcogagliardi Jun 10, 2024
c4c3c1d
removed V2 flag
marcogagliardi Jun 10, 2024
e27e54c
removed hide-audio-search-tile
marcogagliardi Jun 10, 2024
b32f559
removed hrs-integration
marcogagliardi Jun 10, 2024
a8c68e0
Update dashboard.component.spec.ts
marcogagliardi Jun 10, 2024
f924833
removed unit test for V1
marcogagliardi Jun 10, 2024
32afa45
test fixed
marcogagliardi Jun 10, 2024
42bc53c
Update AudioPlatformControllerTests.cs
marcogagliardi Jun 11, 2024
a62e175
test fix
marcogagliardi Jun 12, 2024
c167bc8
lint fix
marcogagliardi Jun 12, 2024
b74d7cb
Merge branch 'master' into VIH-10350---Decommission-obsolete-feature-…
marcogagliardi Jun 12, 2024
3f18eb9
Merge branch 'master' into VIH-10350---Decommission-obsolete-feature-…
marcogagliardi Jun 14, 2024
63b6f48
test fix
marcogagliardi Jun 14, 2024
b2c9d33
Update endpoints.component.spec.ts
marcogagliardi Jun 17, 2024
f85d07e
Update hearing-details.component.html
marcogagliardi Jun 17, 2024
8f8ef32
Update create-hearing.component.ts
marcogagliardi Jun 17, 2024
960bc4d
Update azure-pipelines.sds.pr-release.yml
SwapnaVersion1 Jun 17, 2024
db72ab7
Update azure-pipelines.sds.pr-release.yml
SwapnaVersion1 Jun 17, 2024
b4ba984
Update azure-pipelines.sds.pr-release.yml
SwapnaVersion1 Jun 17, 2024
6621c38
Update azure-pipelines.sds.pr-release.yml for Azure Pipelines
SwapnaVersion1 Jun 17, 2024
76911ec
Update docker-compose.yml
SwapnaVersion1 Jun 17, 2024
9fa9e36
Update docker-compose.yml
SwapnaVersion1 Jun 17, 2024
da066d4
Update docker-compose.yml
SwapnaVersion1 Jun 17, 2024
efe0c00
Update azure-pipelines.sds.pr-release.yml for Azure Pipelines
SwapnaVersion1 Jun 18, 2024
7512762
Update azure-pipelines.sds.pr-release.yml for Azure Pipelines
SwapnaVersion1 Jun 18, 2024
1d4d4fb
Update azure-pipelines.sds.pr-release.yml
SwapnaVersion1 Jun 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Threading.Tasks;
using AdminWebsite.Configuration;
using AdminWebsite.Controllers;
using AdminWebsite.Models;
using BookingsApi.Client;
Expand All @@ -20,16 +19,14 @@ public class AudioPlatformControllerTests

private readonly Mock<IBookingsApiClient> _bookingsApiClientMock;
private readonly Mock<ILogger<AudioPlatformController>> _loggerMock;
private readonly Mock<IFeatureToggles> _featureTogglesMock;

public AudioPlatformControllerTests()
{
_videoApiClientMock = new Mock<IVideoApiClient>();
_bookingsApiClientMock = new Mock<IBookingsApiClient>();
_loggerMock = new Mock<ILogger<AudioPlatformController>>();
_featureTogglesMock = new Mock<IFeatureToggles>();

_controller = new AudioPlatformController(_videoApiClientMock.Object, _loggerMock.Object, _bookingsApiClientMock.Object, _featureTogglesMock.Object);
_controller = new AudioPlatformController(_videoApiClientMock.Object, _loggerMock.Object, _bookingsApiClientMock.Object);
}

[Test]
Expand All @@ -41,7 +38,6 @@ public async Task Should_return_ok()
};

_videoApiClientMock.Setup(x => x.GetAudioRecordingLinkAsync(It.IsAny<string>())).ReturnsAsync(audioResponse);
_featureTogglesMock.Setup(x => x.HrsEnabled()).Returns(false);

var result = await _controller.GetAudioRecordingLinkAsync(It.IsAny<Guid>());

Expand All @@ -55,7 +51,7 @@ public async Task Should_return_ok()
}

[Test]
public async Task Should_return_hrs_file_format_with_hrs_toggle_on()
public async Task Should_return_hrs_file_format()
{
var audioResponse = new AudioRecordingResponse
{
Expand All @@ -72,7 +68,6 @@ public async Task Should_return_hrs_file_format_with_hrs_toggle_on()
};

_videoApiClientMock.Setup(x => x.GetAudioRecordingLinkAsync(It.IsAny<string>())).ReturnsAsync(audioResponse);
_featureTogglesMock.Setup(x => x.HrsEnabled()).Returns(true);
_bookingsApiClientMock.Setup(x => x.GetHearingDetailsByIdV2Async(It.IsAny<Guid>())).ReturnsAsync(hearing);

var result = await _controller.GetAudioRecordingLinkAsync(It.IsAny<Guid>());
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -24,69 +24,10 @@ protected override void Setup()
UserIdentity.Setup(x => x.GetUserIdentityName()).Returns(UpdatedBy);
}

[TestCase(false)]
[TestCase(true)]
public async Task should_cancel_multi_day_hearing_for_v1(bool updateFutureDays)
{
// Arrange
var hearingId = Guid.NewGuid();
var groupId = Guid.NewGuid();
var hearingDates = new List<DateTime>
{
DateTime.Today.AddDays(1).AddHours(10),
DateTime.UtcNow.AddDays(2).AddHours(10),
DateTime.UtcNow.AddDays(3).AddHours(10),
DateTime.UtcNow.AddDays(4).AddHours(10),
DateTime.UtcNow.AddDays(5).AddHours(10),
};
var existingHearingsInMultiDayGroup = CreateListOfV1HearingsInMultiDayGroup(groupId, hearingId, scheduledDates: hearingDates);
existingHearingsInMultiDayGroup[3].Status = BookingStatus.Cancelled;
existingHearingsInMultiDayGroup[4].Status = BookingStatus.Failed;
BookingsApiClient.Setup(x => x.GetHearingsByGroupIdAsync(groupId)).ReturnsAsync(existingHearingsInMultiDayGroup);
var hearing = existingHearingsInMultiDayGroup.First(x => x.Id == hearingId);
BookingsApiClient.Setup(x => x.GetHearingDetailsByIdAsync(hearingId)).ReturnsAsync(hearing);

var request = CreateRequest();
request.UpdateFutureDays = updateFutureDays;

FeatureToggle.Setup(e => e.UseV2Api()).Returns(false);

// Act
var response = await Controller.CancelMultiDayHearing(hearing.Id, request);

// Assert
var result = (OkObjectResult)response;
result.StatusCode.Should().Be(StatusCodes.Status200OK);
result.Value.Should().NotBeNull().And.BeAssignableTo<UpdateBookingStatusResponse>().Subject.Success.Should().BeTrue();

var expectedUpdatedHearings = new List<HearingDetailsResponse>();
if (updateFutureDays)
{
expectedUpdatedHearings.AddRange(existingHearingsInMultiDayGroup);
}
else
{
expectedUpdatedHearings.Add(hearing);
}

expectedUpdatedHearings = expectedUpdatedHearings
.Where(h =>
h.Status != BookingStatus.Cancelled &&
h.Status != BookingStatus.Failed)
.ToList();

BookingsApiClient.Verify(x => x.CancelHearingsInGroupAsync(
groupId,
It.Is<CancelHearingsInGroupRequest>(r =>
r.UpdatedBy == UpdatedBy &&
r.CancelReason == request.CancelReason &&
r.HearingIds.SequenceEqual(expectedUpdatedHearings.Select(h => h.Id)))),
Times.Once);
}

[TestCase(false)]
[TestCase(true)]
public async Task should_cancel_multi_day_hearing_for_v2(bool updateFutureDays)
public async Task should_cancel_multi_day_hearing(bool updateFutureDays)
{
// Arrange
var hearingId = Guid.NewGuid();
Expand All @@ -109,9 +50,7 @@ public async Task should_cancel_multi_day_hearing_for_v2(bool updateFutureDays)

var request = CreateRequest();
request.UpdateFutureDays = updateFutureDays;

FeatureToggle.Setup(e => e.UseV2Api()).Returns(true);


// Act
var response = await Controller.CancelMultiDayHearing(hearing.Id, request);

Expand Down Expand Up @@ -145,9 +84,8 @@ public async Task should_cancel_multi_day_hearing_for_v2(bool updateFutureDays)
Times.Once);
}

[TestCase(false)]
[TestCase(true)]
public async Task Should_forward_not_found_from_bookings_api(bool useV2)
[Test]
public async Task Should_forward_not_found_from_bookings_api()
{
// Arrange
var hearingId = Guid.NewGuid();
Expand All @@ -159,17 +97,8 @@ public async Task Should_forward_not_found_from_bookings_api(bool useV2)
null,
errorMessage,
null);
if (useV2)
{
BookingsApiClient.Setup(x => x.GetHearingDetailsByIdV2Async(hearingId))
BookingsApiClient.Setup(x => x.GetHearingDetailsByIdV2Async(hearingId))
.ThrowsAsync(apiException);
}
else
{
BookingsApiClient.Setup(x => x.GetHearingDetailsByIdAsync(hearingId))
.ThrowsAsync(apiException);
}
FeatureToggle.Setup(e => e.UseV2Api()).Returns(useV2);

// Act
var result = await Controller.CancelMultiDayHearing(hearingId, request);
Expand All @@ -179,26 +108,18 @@ public async Task Should_forward_not_found_from_bookings_api(bool useV2)
notFoundResult.Value.Should().Be(errorMessage);
}

[TestCase(false)]
[TestCase(true)]
public async Task Should_return_bad_request_when_hearing_is_not_multi_day(bool useV2)
[Test]
public async Task Should_return_bad_request_when_hearing_is_not_multi_day()
{
// Arrange
var hearingId = Guid.NewGuid();
var groupId = Guid.NewGuid();
var existingHearingsInMultiDayGroup = CreateListOfV1HearingsInMultiDayGroup(groupId, hearingId);
var hearing = existingHearingsInMultiDayGroup.First(x => x.Id == hearingId);
hearing.GroupId = null;
if (useV2)
{
var mappedHearing = MapHearingDetailsForV2(hearing);
BookingsApiClient.Setup(x => x.GetHearingDetailsByIdV2Async(hearingId)).ReturnsAsync(mappedHearing);
}
else
{
BookingsApiClient.Setup(x => x.GetHearingDetailsByIdAsync(hearingId)).ReturnsAsync(hearing);
}
FeatureToggle.Setup(e => e.UseV2Api()).Returns(useV2);

var mappedHearing = MapHearingDetailsForV2(hearing);
BookingsApiClient.Setup(x => x.GetHearingDetailsByIdV2Async(hearingId)).ReturnsAsync(mappedHearing);

var request = CreateRequest();

Expand All @@ -218,55 +139,6 @@ public async Task Should_return_bad_request_when_hearing_is_not_multi_day(bool u
errors.Should().BeEquivalentTo(validationProblemDetails.Errors);
}

[Test]
public async Task Should_forward_bad_request_from_bookings_api()
{
// Arrange
var hearingId = Guid.NewGuid();
var request = new CancelMultiDayHearingRequest();
var validationProblemDetails = new ValidationProblemDetails(new Dictionary<string, string[]>
{
{"id", ["Please provide a valid id"] }
});
var apiException = new BookingsApiException<ValidationProblemDetails>("BadRequest",
(int)HttpStatusCode.BadRequest,
"Please provide a valid id",
null,
validationProblemDetails,
null);
BookingsApiClient.Setup(x => x.GetHearingDetailsByIdAsync(hearingId))
.ThrowsAsync(apiException);

// Act
var result = await Controller.CancelMultiDayHearing(hearingId, request);

var objectResult = (ObjectResult)result;
var validationProblems = (ValidationProblemDetails)objectResult.Value;

var errors = validationProblems.Errors;
errors.Should().BeEquivalentTo(validationProblemDetails.Errors);
}

[Test]
public void Should_forward_unhandled_error_from_bookings_api()
{
// Arrange
var hearingId = Guid.NewGuid();
var request = new CancelMultiDayHearingRequest();
var errorMessage = "Unexpected error for unit test";
var apiException = new BookingsApiException<string>("Server Error",
(int) HttpStatusCode.InternalServerError,
"Server Error", null, errorMessage, null);
BookingsApiClient.Setup(x => x.GetHearingDetailsByIdAsync(hearingId))
.ThrowsAsync(apiException);

// Act & Assert
var response = Controller.CancelMultiDayHearing(hearingId, request);

((ObjectResult) response.Result).StatusCode.Should().Be(500);

}

private static CancelMultiDayHearingRequest CreateRequest() =>
new()
{
Expand Down
Loading
Loading