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

Fixed tests.

This commit is contained in:
jrmccannon 2025-03-20 09:11:09 -05:00
parent a2b155e81c
commit 829e49c398
No known key found for this signature in database
GPG Key ID: CF03F3DB01CE96A6
3 changed files with 7 additions and 14 deletions

View File

@ -12,10 +12,9 @@ public class InviteOrganizationUserRequestTests
{
[Theory]
[BitAutoData]
public void Create_WhenPassedInvalidEmail_ThrowsException(string email,
OrganizationUserType type, Permissions permissions, bool accessSecretsManager)
public void Create_WhenPassedInvalidEmail_ThrowsException(string email, OrganizationUserType type, Permissions permissions)
{
var action = () => new OrganizationUserSingleEmailInvite(email, [], type, permissions, accessSecretsManager);
var action = () => new OrganizationUserSingleEmailInvite(email, [], type, permissions);
var exception = Assert.Throws<BadRequestException>(action);
@ -24,13 +23,13 @@ public class InviteOrganizationUserRequestTests
[Theory]
[BitAutoData]
public void Create_WhenPassedInvalidCollectionAccessConfiguration_ThrowsException(OrganizationUserType type, Permissions permissions, bool accessSecretsManager)
public void Create_WhenPassedInvalidCollectionAccessConfiguration_ThrowsException(OrganizationUserType type, Permissions permissions)
{
var validEmail = "test@email.com";
var invalidCollectionConfiguration = new CollectionAccessSelection { Manage = true, HidePasswords = true };
var action = () => new OrganizationUserSingleEmailInvite(validEmail, [invalidCollectionConfiguration], type, permissions, accessSecretsManager);
var action = () => new OrganizationUserSingleEmailInvite(validEmail, [invalidCollectionConfiguration], type, permissions);
var exception = Assert.Throws<BadRequestException>(action);
@ -39,12 +38,12 @@ public class InviteOrganizationUserRequestTests
[Theory]
[BitAutoData]
public void Create_WhenPassedValidArguments_ReturnsInvite(OrganizationUserType type, Permissions permissions, bool accessSecretsManager)
public void Create_WhenPassedValidArguments_ReturnsInvite(OrganizationUserType type, Permissions permissions)
{
const string validEmail = "test@email.com";
var validCollectionConfiguration = new CollectionAccessSelection { Id = Guid.NewGuid(), Manage = true };
var invite = new OrganizationUserSingleEmailInvite(validEmail, [validCollectionConfiguration], type, permissions, accessSecretsManager);
var invite = new OrganizationUserSingleEmailInvite(validEmail, [validCollectionConfiguration], type, permissions);
Assert.NotNull(invite);
Assert.Equal(validEmail, invite.Email);

View File

@ -14,7 +14,7 @@ public static class InviteUserOrganizationValidationRequestHelpers
Invites =
[
OrganizationUserInviteDto.Create(request.Email,
OrganizationUserInvite.Create(request), inviteOrganization.OrganizationId)
OrganizationUserInvite.Create(request, inviteOrganization.UseSecretsManager), inviteOrganization.OrganizationId)
],
InviteOrganization = inviteOrganization,
PerformedBy = Guid.Empty,

View File

@ -44,7 +44,6 @@ public class InviteOrganizationUserCommandTests
var organizationDto = new InviteOrganization(organization);
var request = new OrganizationUserSingleEmailInvite(user.Email,
true,
organizationDto,
timeProvider.GetUtcNow(),
externalId);
@ -93,7 +92,6 @@ public class InviteOrganizationUserCommandTests
var organizationDto = new InviteOrganization(organization);
var request = new OrganizationUserSingleEmailInvite(orgUser.Email,
true,
organizationDto,
timeProvider.GetUtcNow(),
externalId);
@ -146,7 +144,6 @@ public class InviteOrganizationUserCommandTests
var organizationDto = new InviteOrganization(organization);
var request = new OrganizationUserSingleEmailInvite(user.Email,
true,
organizationDto,
timeProvider.GetUtcNow(),
externalId);
@ -201,7 +198,6 @@ public class InviteOrganizationUserCommandTests
var organizationDto = new InviteOrganization(organization);
var request = new OrganizationUserSingleEmailInvite(user.Email,
true,
organizationDto,
timeProvider.GetUtcNow(),
externalId);
@ -259,7 +255,6 @@ public class InviteOrganizationUserCommandTests
var organizationDto = new InviteOrganization(organization);
var request = new OrganizationUserSingleEmailInvite(user.Email,
true,
organizationDto,
timeProvider.GetUtcNow(),
externalId);
@ -322,7 +317,6 @@ public class InviteOrganizationUserCommandTests
var organizationDto = new InviteOrganization(organization);
var request = new OrganizationUserSingleEmailInvite(user.Email,
true,
organizationDto,
timeProvider.GetUtcNow(),
externalId);