mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 05:00:19 -05:00
Fixed tests.
This commit is contained in:
parent
a2b155e81c
commit
829e49c398
@ -12,10 +12,9 @@ public class InviteOrganizationUserRequestTests
|
|||||||
{
|
{
|
||||||
[Theory]
|
[Theory]
|
||||||
[BitAutoData]
|
[BitAutoData]
|
||||||
public void Create_WhenPassedInvalidEmail_ThrowsException(string email,
|
public void Create_WhenPassedInvalidEmail_ThrowsException(string email, OrganizationUserType type, Permissions permissions)
|
||||||
OrganizationUserType type, Permissions permissions, bool accessSecretsManager)
|
|
||||||
{
|
{
|
||||||
var action = () => new OrganizationUserSingleEmailInvite(email, [], type, permissions, accessSecretsManager);
|
var action = () => new OrganizationUserSingleEmailInvite(email, [], type, permissions);
|
||||||
|
|
||||||
var exception = Assert.Throws<BadRequestException>(action);
|
var exception = Assert.Throws<BadRequestException>(action);
|
||||||
|
|
||||||
@ -24,13 +23,13 @@ public class InviteOrganizationUserRequestTests
|
|||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[BitAutoData]
|
[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 validEmail = "test@email.com";
|
||||||
|
|
||||||
var invalidCollectionConfiguration = new CollectionAccessSelection { Manage = true, HidePasswords = true };
|
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);
|
var exception = Assert.Throws<BadRequestException>(action);
|
||||||
|
|
||||||
@ -39,12 +38,12 @@ public class InviteOrganizationUserRequestTests
|
|||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[BitAutoData]
|
[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";
|
const string validEmail = "test@email.com";
|
||||||
var validCollectionConfiguration = new CollectionAccessSelection { Id = Guid.NewGuid(), Manage = true };
|
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.NotNull(invite);
|
||||||
Assert.Equal(validEmail, invite.Email);
|
Assert.Equal(validEmail, invite.Email);
|
||||||
|
@ -14,7 +14,7 @@ public static class InviteUserOrganizationValidationRequestHelpers
|
|||||||
Invites =
|
Invites =
|
||||||
[
|
[
|
||||||
OrganizationUserInviteDto.Create(request.Email,
|
OrganizationUserInviteDto.Create(request.Email,
|
||||||
OrganizationUserInvite.Create(request), inviteOrganization.OrganizationId)
|
OrganizationUserInvite.Create(request, inviteOrganization.UseSecretsManager), inviteOrganization.OrganizationId)
|
||||||
],
|
],
|
||||||
InviteOrganization = inviteOrganization,
|
InviteOrganization = inviteOrganization,
|
||||||
PerformedBy = Guid.Empty,
|
PerformedBy = Guid.Empty,
|
||||||
|
@ -44,7 +44,6 @@ public class InviteOrganizationUserCommandTests
|
|||||||
var organizationDto = new InviteOrganization(organization);
|
var organizationDto = new InviteOrganization(organization);
|
||||||
|
|
||||||
var request = new OrganizationUserSingleEmailInvite(user.Email,
|
var request = new OrganizationUserSingleEmailInvite(user.Email,
|
||||||
true,
|
|
||||||
organizationDto,
|
organizationDto,
|
||||||
timeProvider.GetUtcNow(),
|
timeProvider.GetUtcNow(),
|
||||||
externalId);
|
externalId);
|
||||||
@ -93,7 +92,6 @@ public class InviteOrganizationUserCommandTests
|
|||||||
var organizationDto = new InviteOrganization(organization);
|
var organizationDto = new InviteOrganization(organization);
|
||||||
|
|
||||||
var request = new OrganizationUserSingleEmailInvite(orgUser.Email,
|
var request = new OrganizationUserSingleEmailInvite(orgUser.Email,
|
||||||
true,
|
|
||||||
organizationDto,
|
organizationDto,
|
||||||
timeProvider.GetUtcNow(),
|
timeProvider.GetUtcNow(),
|
||||||
externalId);
|
externalId);
|
||||||
@ -146,7 +144,6 @@ public class InviteOrganizationUserCommandTests
|
|||||||
var organizationDto = new InviteOrganization(organization);
|
var organizationDto = new InviteOrganization(organization);
|
||||||
|
|
||||||
var request = new OrganizationUserSingleEmailInvite(user.Email,
|
var request = new OrganizationUserSingleEmailInvite(user.Email,
|
||||||
true,
|
|
||||||
organizationDto,
|
organizationDto,
|
||||||
timeProvider.GetUtcNow(),
|
timeProvider.GetUtcNow(),
|
||||||
externalId);
|
externalId);
|
||||||
@ -201,7 +198,6 @@ public class InviteOrganizationUserCommandTests
|
|||||||
var organizationDto = new InviteOrganization(organization);
|
var organizationDto = new InviteOrganization(organization);
|
||||||
|
|
||||||
var request = new OrganizationUserSingleEmailInvite(user.Email,
|
var request = new OrganizationUserSingleEmailInvite(user.Email,
|
||||||
true,
|
|
||||||
organizationDto,
|
organizationDto,
|
||||||
timeProvider.GetUtcNow(),
|
timeProvider.GetUtcNow(),
|
||||||
externalId);
|
externalId);
|
||||||
@ -259,7 +255,6 @@ public class InviteOrganizationUserCommandTests
|
|||||||
var organizationDto = new InviteOrganization(organization);
|
var organizationDto = new InviteOrganization(organization);
|
||||||
|
|
||||||
var request = new OrganizationUserSingleEmailInvite(user.Email,
|
var request = new OrganizationUserSingleEmailInvite(user.Email,
|
||||||
true,
|
|
||||||
organizationDto,
|
organizationDto,
|
||||||
timeProvider.GetUtcNow(),
|
timeProvider.GetUtcNow(),
|
||||||
externalId);
|
externalId);
|
||||||
@ -322,7 +317,6 @@ public class InviteOrganizationUserCommandTests
|
|||||||
var organizationDto = new InviteOrganization(organization);
|
var organizationDto = new InviteOrganization(organization);
|
||||||
|
|
||||||
var request = new OrganizationUserSingleEmailInvite(user.Email,
|
var request = new OrganizationUserSingleEmailInvite(user.Email,
|
||||||
true,
|
|
||||||
organizationDto,
|
organizationDto,
|
||||||
timeProvider.GetUtcNow(),
|
timeProvider.GetUtcNow(),
|
||||||
externalId);
|
externalId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user