-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(registration): add endpoint for decline registration data (#388)
* add endpoint returning data required for decline-application-by-invited-user page * add unit tests --------- Co-authored-by: Norbert Truchsess <[email protected]> Reviewed-by: Norbert Truchsess <[email protected]>
- Loading branch information
1 parent
2d99938
commit 514d2ed
Showing
9 changed files
with
98 additions
and
1 deletion.
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
********************************************************************************/ | ||
|
||
using Microsoft.EntityFrameworkCore; | ||
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Models; | ||
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Repositories; | ||
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.DBAccess.Tests.Setup; | ||
using Org.Eclipse.TractusX.Portal.Backend.PortalBackend.PortalEntities; | ||
|
@@ -533,6 +534,52 @@ public async Task AttachAndModifyCompanyApplications() | |
|
||
#endregion | ||
|
||
#region GetCompanyApplicationsDeclineData | ||
|
||
[Fact] | ||
public async Task GetCompanyApplicationsDeclineData_ReturnsExpected() | ||
{ | ||
// Arrange | ||
var sut = await CreateSut().ConfigureAwait(false); | ||
var statusIds = new[] { | ||
CompanyApplicationStatusId.CREATED, | ||
CompanyApplicationStatusId.ADD_COMPANY_DATA, | ||
CompanyApplicationStatusId.INVITE_USER, | ||
CompanyApplicationStatusId.SELECT_COMPANY_ROLE, | ||
CompanyApplicationStatusId.UPLOAD_DOCUMENTS, | ||
CompanyApplicationStatusId.VERIFY | ||
}; | ||
|
||
// Act | ||
var result = await sut.GetCompanyApplicationsDeclineData(CompanyId, statusIds).ToListAsync().ConfigureAwait(false); | ||
|
||
// Assert | ||
result.Should().BeEmpty(); | ||
} | ||
|
||
[Fact] | ||
public async Task GetCompanyApplicationsDeclineData_WithSubmittedApplication_ReturnsExpected() | ||
{ | ||
// Arrange | ||
var sut = await CreateSut().ConfigureAwait(false); | ||
var statusIds = new[] { | ||
CompanyApplicationStatusId.SUBMITTED | ||
}; | ||
|
||
// Act | ||
var result = await sut.GetCompanyApplicationsDeclineData(CompanyId, statusIds).ToListAsync().ConfigureAwait(false); | ||
|
||
// Assert | ||
result.Should().ContainSingle().Which.Should().Match<CompanyApplicationDeclineData>(x => | ||
x.ApplicationId == new Guid("6b2d1263-c073-4a48-bfaf-704dc154ca9f") && | ||
x.ApplicationStatus == CompanyApplicationStatusId.SUBMITTED && | ||
x.CompanyName == "CX-Test-Access" && | ||
x.Users.Count() == 1 && | ||
x.Users.First() == "[email protected]"); | ||
} | ||
|
||
#endregion | ||
|
||
private async Task<(IApplicationRepository sut, PortalDbContext context)> CreateSutWithContext() | ||
{ | ||
var context = await _dbTestDbFixture.GetPortalDbContext().ConfigureAwait(false); | ||
|