1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 09:32:48 -05:00

Finish emails

This commit is contained in:
Justin Baur
2021-11-17 22:06:49 -05:00
parent 0a9d35c43f
commit b0760b2134
12 changed files with 165 additions and 31 deletions

View File

@ -35,7 +35,7 @@ namespace Bit.Core.Test.Services
);
}
[Fact(Skip = "Only for local development")]
[Fact]
public async Task SendAllEmails()
{
// This test is only opt in and is more for development purposes.
@ -115,6 +115,9 @@ namespace Bit.Core.Test.Services
{ ("familyUserEmail", typeof(string)), "test@bitwarden.com" },
{ ("sponsorEmail", typeof(string)), "test@bitwarden.com" },
{ ("familyOrgName", typeof(string)), "Test Org Name" },
{ ("orgCanSponsor", typeof(bool)), true },
{ ("existingAccount", typeof(bool)), true },
{ ("sponsorshipEndDate", typeof(DateTime)), DateTime.UtcNow.AddDays(1)},
};
var globalSettings = new GlobalSettings

View File

@ -28,7 +28,7 @@ namespace Bit.Core.Test.Services
public class OrganizationServiceTests
{
// [Fact]
[Theory, PaidOrganizationAutoData]
[Theory, PaidOrganizationAutoData(PlanType.EnterpriseAnnually)]
public async Task OrgImportCreateNewUsers(SutProvider<OrganizationService> sutProvider, Guid userId,
Organization org, List<OrganizationUserUserDetails> existingUsers, List<ImportedOrganizationUser> newUsers)
{
@ -66,6 +66,7 @@ namespace Bit.Core.Test.Services
.CreateManyAsync(Arg.Is<IEnumerable<OrganizationUser>>(users => users.Count() == expectedNewUsersCount));
await sutProvider.GetDependency<IMailService>().Received(1)
.BulkSendOrganizationInviteEmailAsync(org.Name,
true,
Arg.Is<IEnumerable<(OrganizationUser, ExpiringToken)>>(messages => messages.Count() == expectedNewUsersCount));
// Send events
@ -124,6 +125,7 @@ namespace Bit.Core.Test.Services
.CreateManyAsync(Arg.Is<IEnumerable<OrganizationUser>>(users => users.Count() == expectedNewUsersCount));
await sutProvider.GetDependency<IMailService>().Received(1)
.BulkSendOrganizationInviteEmailAsync(org.Name,
false,
Arg.Is<IEnumerable<(OrganizationUser, ExpiringToken)>>(messages => messages.Count() == expectedNewUsersCount));
// Sent events