Skip to content

Commit

Permalink
CON-3503 - Remove EditApprenticeV2 flag (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
VasanthaKasirajan3008 authored Jun 23, 2021
1 parent c17428f commit 49c81aa
Show file tree
Hide file tree
Showing 24 changed files with 60 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ public ApprenticeControllerTestFixtureBase()
Mock.Of<ICookieStorageService<IndexRequest>>(),
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
_mockAuthorizationService.Object);
Mock.Of<ILogger<ApprenticeController>>());

_controller.Url = _mockUrlHelper.Object;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public WhenCallingChangeProviderRequestedConfirmationPageTestsFixture()
Mock.Of<ICookieStorageService<IndexRequest>>(),
Mock.Of<ICommitmentsApiClient>(),
Mock.Of<ILinkGenerator>(),
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
Mock.Of<ILogger<ApprenticeController>>());
}

public async Task<IActionResult> ChangeProviderRequested()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ public WhenCallingGetSendRequestNewTrainingProviderTestsFixture()
_controller = new ApprenticeController(_modelMapper.Object,
Mock.Of<ICookieStorageService<IndexRequest>>(),
Mock.Of<ICommitmentsApiClient>(),
Mock.Of<ILinkGenerator>(),
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
Mock.Of<ILinkGenerator>(),
Mock.Of<ILogger<ApprenticeController>>());
}

public async Task<IActionResult> SendRequestNewTrainingProvider()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public WhenCallingTheViewChangesPageTestsFixture()
Mock.Of<ICookieStorageService<IndexRequest>>(),
Mock.Of<ICommitmentsApiClient>(),
Mock.Of<ILinkGenerator>(),
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
Mock.Of<ILogger<ApprenticeController>>());
}

public async Task<IActionResult> ViewChanges()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public void Arrange()
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
Mock.Of<ILogger<ApprenticeController>>());
}

[Test, MoqAutoData]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public void Arrange()
Mock.Of<ICookieStorageService<IndexRequest>>(),
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
Mock.Of<ILogger<ApprenticeController>>());
_controller.TempData = new TempDataDictionary(new Mock<HttpContext>().Object, new Mock<ITempDataProvider>().Object);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ public void Arrange()
_controller = new ApprenticeController(_mockModelMapper.Object,
Mock.Of<ICookieStorageService<IndexRequest>>(),
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>());
_controller.TempData = new TempDataDictionary(new Mock<HttpContext>().Object, new Mock<ITempDataProvider>().Object);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ public void Arrange()
_mockCommitmentsApiClient = new Mock<ICommitmentsApiClient>();
_mockLinkGenerator = new Mock<ILinkGenerator>();

_controller = new ApprenticeController(_mockModelMapper.Object,
_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>());
_controller.TempData = new TempDataDictionary(new Mock<HttpContext>().Object, new Mock<ITempDataProvider>().Object);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public void Arrange()
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
Mock.Of<ILogger<ApprenticeController>>());
_controller.TempData = new TempDataDictionary(new Mock<HttpContext>().Object, new Mock<ITempDataProvider>().Object);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ public void Arrange()
{
_controller = new ApprenticeController(Mock.Of<IModelMapper>(),
Mock.Of<ICookieStorageService<IndexRequest>>(),
Mock.Of<ICommitmentsApiClient>(),
Mock.Of<ILinkGenerator>(),
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
Mock.Of<ICommitmentsApiClient>(),
Mock.Of<ILinkGenerator>(),
Mock.Of<ILogger<ApprenticeController>>());
}

[Test, MoqAutoData]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ public void Arrange()
_mockCommitmentsApiClient = new Mock<ICommitmentsApiClient>();
_mockLinkGenerator = new Mock<ILinkGenerator>();

_controller = new ApprenticeController(_mockModelMapper.Object,
_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>());
_controller.TempData = new TempDataDictionary(new Mock<HttpContext>().Object, new Mock<ITempDataProvider>().Object);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ public void Arrange()
_mockCommitmentsApiClient = new Mock<ICommitmentsApiClient>();
_mockLinkGenerator = new Mock<ILinkGenerator>();

_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>());
_controller.TempData = new TempDataDictionary(new Mock<HttpContext>().Object, new Mock<ITempDataProvider>().Object);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ public WhenPostingSendRequestNewTrainingProviderTestsFixture()
Mock.Of<ICookieStorageService<IndexRequest>>(),
_commitmentsApiClient.Object,
_linkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
Mock.Of<ILogger<ApprenticeController>>());
}

public async Task<IActionResult> SendRequestNewTrainingProvider()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ public void Arrange()
{
_controller = new ApprenticeController(Mock.Of<IModelMapper>(),
Mock.Of<ICookieStorageService<IndexRequest>>(),
Mock.Of<ICommitmentsApiClient>(),
Mock.Of<ILinkGenerator>(),
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
Mock.Of<ICommitmentsApiClient>(),
Mock.Of<ILinkGenerator>(),
Mock.Of<ILogger<ApprenticeController>>());
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ public void Arrange()
_mockCommitmentsApiClient = new Mock<ICommitmentsApiClient>();
_mockLinkGenerator = new Mock<ILinkGenerator>();

_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>());
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ public void Arrange()
_mockCommitmentsApiClient = new Mock<ICommitmentsApiClient>();
_mockLinkGenerator = new Mock<ILinkGenerator>();

_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>());
}

[Test, MoqAutoData]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ public void Arrange()
_mockCommitmentsApiClient = new Mock<ICommitmentsApiClient>();
_mockLinkGenerator = new Mock<ILinkGenerator>();

_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>());
}

[Test, MoqAutoData]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ public void Arrange()
_mockCommitmentsApiClient = new Mock<ICommitmentsApiClient>();
_mockLinkGenerator = new Mock<ILinkGenerator>();

_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>());
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ public void Arrange()
_mockCommitmentsApiClient = new Mock<ICommitmentsApiClient>();
_mockLinkGenerator = new Mock<ILinkGenerator>();

_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>());
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ public void Arrange()
_mockCommitmentsApiClient = new Mock<ICommitmentsApiClient>();
_mockLinkGenerator = new Mock<ILinkGenerator>();

_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_controller = new ApprenticeController(_mockModelMapper.Object,
_mockCookieStorageService.Object,
_mockCommitmentsApiClient.Object,
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>(),
Mock.Of<IAuthorizationService>());
_mockLinkGenerator.Object,
Mock.Of<ILogger<ApprenticeController>>());
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public class ApprenticeController : Controller
private readonly ICookieStorageService<IndexRequest> _cookieStorage;
private readonly ICommitmentsApiClient _commitmentsApiClient;
private readonly ILinkGenerator _linkGenerator;
private readonly ILogger<ApprenticeController> _logger;
private readonly IAuthorizationService _authorizationService;
private readonly ILogger<ApprenticeController> _logger;
private const string ApprenticePausedMessage = "Apprenticeship paused";
private const string ApprenticeResumeMessage = "Apprenticeship resumed";
private const string ApprenticeStoppedMessage = "Apprenticeship stopped";
Expand All @@ -46,14 +45,13 @@ public class ApprenticeController : Controller
private const string ChangesRejectedMessage = "Changes rejected";
private const string ChangesUndoneMessage = "Changes undone";

public ApprenticeController(IModelMapper modelMapper, ICookieStorageService<IndexRequest> cookieStorage, ICommitmentsApiClient commitmentsApiClient, ILinkGenerator linkGenerator, ILogger<ApprenticeController> logger, IAuthorizationService authorizationService)
public ApprenticeController(IModelMapper modelMapper, ICookieStorageService<IndexRequest> cookieStorage, ICommitmentsApiClient commitmentsApiClient, ILinkGenerator linkGenerator, ILogger<ApprenticeController> logger)
{
_modelMapper = modelMapper;
_cookieStorage = cookieStorage;
_commitmentsApiClient = commitmentsApiClient;
_linkGenerator = linkGenerator;
_logger = logger;
_authorizationService = authorizationService;
_logger = logger;
}

[Route("", Name = RouteNames.ApprenticesIndex)]
Expand Down Expand Up @@ -552,8 +550,6 @@ public async Task<IActionResult> ResumeApprenticeship(ResumeRequestViewModel vie
public async Task<IActionResult> ApprenticeshipDetails(ApprenticeshipDetailsRequest request)
{
var viewModel = await _modelMapper.Map<ApprenticeshipDetailsRequestViewModel>(request);

viewModel.IsV2Edit = _authorizationService.IsAuthorized(EmployerFeature.EditApprenticeV2);

return View("details", viewModel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ public class ApprenticeshipDetailsRequestViewModel : IAuthorizationContextModel
public bool HasPendingChangeOfEmployerRequest { get; set; }
public Party? PendingChangeOfEmployerRequestWithParty { get; set; }
public List<TrainingProviderHistory> TrainingProviderHistory { get; set; }
public bool IsV2Edit { get; set; }


public ActionRequiredBanner GetActionRequiredBanners()
{
var actionRequiredBanner = ActionRequiredBanner.None;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,7 @@
<div class="govuk-grid-column-one-third das-!-text-align-right--from-tablet">
@if (Model.EnableEdit)
{
@if (Model.IsV2Edit)
{
<a id="edit-apprentice-link" href="@Url.Action("EditApprenticeship", new { AccountHashedId = Model.AccountHashedId, ApprenticeshipHashedId = Model.HashedApprenticeshipId })" class="govuk-link govuk-body">Edit</a>
}
else
{
<a id="edit-apprentice-link" href="@LinkGenerator.EditApprenticeship(Model.AccountHashedId, Model.HashedApprenticeshipId)" class="govuk-link govuk-body">Edit</a>
}
<a id="edit-apprentice-link" href="@Url.Action("EditApprenticeship", new { AccountHashedId = Model.AccountHashedId, ApprenticeshipHashedId = Model.HashedApprenticeshipId })" class="govuk-link govuk-body">Edit</a>
}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ public static class EmployerFeature
private const string Prefix = "EmployerFeature.";

public const string EnhancedApproval = Prefix + "EnhancedApproval";
public const string ManageApprenticesV2 = Prefix + "ManageApprenticesV2";
public const string EditApprenticeV2 = Prefix + "EditApprenticeV2";
public const string ManageApprenticesV2 = Prefix + "ManageApprenticesV2";
public const string ApprenticeEmail = Prefix + "ApprenticeEmail";
}
}

0 comments on commit 49c81aa

Please sign in to comment.