1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 05:00:19 -05:00

Had the wrong type in the SutProvider.

This commit is contained in:
jrmccannon 2025-03-20 10:29:11 -05:00
parent 41d0a4563b
commit ff3a55385b
No known key found for this signature in database
GPG Key ID: CF03F3DB01CE96A6

View File

@ -23,12 +23,11 @@ namespace Bit.Core.Test.AdminConsole.OrganizationFeatures.OrganizationUsers;
[SutProviderCustomize] [SutProviderCustomize]
public class RestoreOrganizationUserCommandTests public class RestoreOrganizationUserCommandTests
{ {
[Theory, BitAutoData] [Theory, BitAutoData]
public async Task RestoreUser_Success(Organization organization, public async Task RestoreUser_Success(Organization organization,
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner, [OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
RestoreUser_Setup(organization, owner, organizationUser, sutProvider); RestoreUser_Setup(organization, owner, organizationUser, sutProvider);
@ -46,7 +45,7 @@ public class RestoreOrganizationUserCommandTests
public async Task RestoreUser_WithPushSyncOrgKeysOnRevokeRestoreEnabled_Success(Organization organization, public async Task RestoreUser_WithPushSyncOrgKeysOnRevokeRestoreEnabled_Success(Organization organization,
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner, [OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
RestoreUser_Setup(organization, owner, organizationUser, sutProvider); RestoreUser_Setup(organization, owner, organizationUser, sutProvider);
@ -71,7 +70,7 @@ public class RestoreOrganizationUserCommandTests
public async Task RestoreUser_WithEventSystemUser_Success(Organization organization, public async Task RestoreUser_WithEventSystemUser_Success(Organization organization,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser,
EventSystemUser eventSystemUser, EventSystemUser eventSystemUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
RestoreUser_Setup(organization, null, organizationUser, sutProvider); RestoreUser_Setup(organization, null, organizationUser, sutProvider);
@ -90,7 +89,7 @@ public class RestoreOrganizationUserCommandTests
Organization organization, Organization organization,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser,
EventSystemUser eventSystemUser, EventSystemUser eventSystemUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
RestoreUser_Setup(organization, null, organizationUser, sutProvider); RestoreUser_Setup(organization, null, organizationUser, sutProvider);
@ -115,7 +114,7 @@ public class RestoreOrganizationUserCommandTests
public async Task RestoreUser_RestoreThemselves_Fails(Organization organization, public async Task RestoreUser_RestoreThemselves_Fails(Organization organization,
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner, [OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
organizationUser.UserId = owner.Id; organizationUser.UserId = owner.Id;
RestoreUser_Setup(organization, owner, organizationUser, sutProvider); RestoreUser_Setup(organization, owner, organizationUser, sutProvider);
@ -144,7 +143,7 @@ public class RestoreOrganizationUserCommandTests
Organization organization, Organization organization,
[OrganizationUser(OrganizationUserStatusType.Confirmed)] OrganizationUser restoringUser, [OrganizationUser(OrganizationUserStatusType.Confirmed)] OrganizationUser restoringUser,
[OrganizationUser(OrganizationUserStatusType.Revoked, OrganizationUserType.Owner)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked, OrganizationUserType.Owner)] OrganizationUser organizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
restoringUser.Type = restoringUserType; restoringUser.Type = restoringUserType;
RestoreUser_Setup(organization, restoringUser, organizationUser, sutProvider); RestoreUser_Setup(organization, restoringUser, organizationUser, sutProvider);
@ -174,7 +173,7 @@ public class RestoreOrganizationUserCommandTests
Organization organization, Organization organization,
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner, [OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner,
[OrganizationUser] OrganizationUser organizationUser, [OrganizationUser] OrganizationUser organizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
organizationUser.Status = userStatus; organizationUser.Status = userStatus;
RestoreUser_Setup(organization, owner, organizationUser, sutProvider); RestoreUser_Setup(organization, owner, organizationUser, sutProvider);
@ -201,7 +200,7 @@ public class RestoreOrganizationUserCommandTests
Organization organization, Organization organization,
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner, [OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
organizationUser.Email = organizationUser.Email =
null; // this is required to mock that the user as had already been confirmed before the revoke null; // this is required to mock that the user as had already been confirmed before the revoke
@ -240,7 +239,7 @@ public class RestoreOrganizationUserCommandTests
Organization organization, Organization organization,
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner, [OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
organizationUser.Email = null; organizationUser.Email = null;
@ -289,7 +288,7 @@ public class RestoreOrganizationUserCommandTests
Organization organization, Organization organization,
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner, [OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
organizationUser.Email = organizationUser.Email =
null; // this is required to mock that the user as had already been confirmed before the revoke null; // this is required to mock that the user as had already been confirmed before the revoke
@ -326,7 +325,7 @@ public class RestoreOrganizationUserCommandTests
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner, [OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser,
[OrganizationUser(OrganizationUserStatusType.Accepted)] OrganizationUser secondOrganizationUser, [OrganizationUser(OrganizationUserStatusType.Accepted)] OrganizationUser secondOrganizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
organizationUser.Email = organizationUser.Email =
null; // this is required to mock that the user as had already been confirmed before the revoke null; // this is required to mock that the user as had already been confirmed before the revoke
@ -377,7 +376,7 @@ public class RestoreOrganizationUserCommandTests
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner, [OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser,
[OrganizationUser(OrganizationUserStatusType.Accepted)] OrganizationUser secondOrganizationUser, [OrganizationUser(OrganizationUserStatusType.Accepted)] OrganizationUser secondOrganizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
organizationUser.Email = organizationUser.Email =
null; // this is required to mock that the user as had already been confirmed before the revoke null; // this is required to mock that the user as had already been confirmed before the revoke
@ -422,7 +421,7 @@ public class RestoreOrganizationUserCommandTests
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner, [OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser,
[OrganizationUser(OrganizationUserStatusType.Accepted)] OrganizationUser secondOrganizationUser, [OrganizationUser(OrganizationUserStatusType.Accepted)] OrganizationUser secondOrganizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
organizationUser.Email = organizationUser.Email =
null; // this is required to mock that the user as had already been confirmed before the revoke null; // this is required to mock that the user as had already been confirmed before the revoke
@ -487,7 +486,7 @@ public class RestoreOrganizationUserCommandTests
OrganizationUser owner, OrganizationUser owner,
[OrganizationUser(OrganizationUserStatusType.Revoked)] [OrganizationUser(OrganizationUserStatusType.Revoked)]
OrganizationUser organizationUser, OrganizationUser organizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
organizationUser.Email = null; organizationUser.Email = null;
@ -532,7 +531,7 @@ public class RestoreOrganizationUserCommandTests
Organization organization, Organization organization,
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner, [OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser organizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
organizationUser.Email = organizationUser.Email =
null; // this is required to mock that the user as had already been confirmed before the revoke null; // this is required to mock that the user as had already been confirmed before the revoke
@ -569,7 +568,7 @@ public class RestoreOrganizationUserCommandTests
[OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner, [OrganizationUser(OrganizationUserStatusType.Confirmed, OrganizationUserType.Owner)] OrganizationUser owner,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser orgUser1, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser orgUser1,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser orgUser2, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser orgUser2,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
// Arrange // Arrange
RestoreUser_Setup(organization, owner, orgUser1, sutProvider); RestoreUser_Setup(organization, owner, orgUser1, sutProvider);
@ -617,7 +616,7 @@ public class RestoreOrganizationUserCommandTests
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser orgUser1, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser orgUser1,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser orgUser2, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser orgUser2,
[OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser orgUser3, [OrganizationUser(OrganizationUserStatusType.Revoked)] OrganizationUser orgUser3,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
// Arrange // Arrange
RestoreUser_Setup(organization, owner, orgUser1, sutProvider); RestoreUser_Setup(organization, owner, orgUser1, sutProvider);
@ -681,7 +680,7 @@ public class RestoreOrganizationUserCommandTests
Organization organization, Organization organization,
OrganizationUser? requestingOrganizationUser, OrganizationUser? requestingOrganizationUser,
OrganizationUser targetOrganizationUser, OrganizationUser targetOrganizationUser,
SutProvider<IRestoreOrganizationUserCommand> sutProvider) SutProvider<RestoreOrganizationUserCommand> sutProvider)
{ {
if (requestingOrganizationUser != null) if (requestingOrganizationUser != null)
{ {