Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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,7 +1,5 @@
namespace DigitalLearningSolutions.Web.Tests.Controllers.TrackingSystem.Delegates
{
using System;
using System.Collections.Generic;
using DigitalLearningSolutions.Data.Models;
using DigitalLearningSolutions.Data.Models.Courses;
using DigitalLearningSolutions.Data.Models.CustomPrompts;
Expand All @@ -15,8 +13,11 @@
using DigitalLearningSolutions.Web.ViewModels.TrackingSystem.Delegates.DelegateProgress;
using FakeItEasy;
using FluentAssertions.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using NUnit.Framework;
using System;
using System.Collections.Generic;

public class DelegateProgressControllerTests
{
Expand Down Expand Up @@ -386,7 +387,11 @@ public void Delegate_removal_for_delegate_with_no_active_progress_returns_not_fo
);

// Then
result.Should().BeNotFoundResult();
result.Should()
.BeRedirectToActionResult()
.WithActionName("StatusCode")
.WithControllerName("LearningSolutions")
.WithRouteValue("code", 410);
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,8 @@ public IActionResult ConfirmRemoveFromCourse(
)
{
var progress = progressService.GetDetailedCourseProgress(progressId);
if (progress == null)
{
return StatusCode((int)HttpStatusCode.Gone);
}
if (!courseService.DelegateHasCurrentProgress(progressId) || progress == null)
return RedirectToAction("StatusCode", "LearningSolutions", new { code = 410 });

var model = new RemoveFromCourseViewModel(
progress,
Expand All @@ -305,9 +303,7 @@ RemoveFromCourseViewModel model

var progress = progressService.GetDetailedCourseProgress(progressId);
if (!courseService.DelegateHasCurrentProgress(progressId) || progress == null)
{
return new NotFoundResult();
}
return RedirectToAction("StatusCode", "LearningSolutions", new { code = 410 });

courseService.RemoveDelegateFromCourse(
progress.DelegateId,
Expand Down
Loading