mirror of
https://github.com/bitwarden/server.git
synced 2024-12-11 15:17:44 +01:00
fix tests
This commit is contained in:
parent
d61f431304
commit
c0ca8ba247
@ -313,8 +313,8 @@ public class DeleteManagedOrganizationUserAccountCommandTests
|
|||||||
Assert.All(results, r => Assert.Empty(r.Item2));
|
Assert.All(results, r => Assert.Empty(r.Item2));
|
||||||
|
|
||||||
await sutProvider.GetDependency<IOrganizationUserRepository>().Received(1).GetManyAsync(userIds);
|
await sutProvider.GetDependency<IOrganizationUserRepository>().Received(1).GetManyAsync(userIds);
|
||||||
await sutProvider.GetDependency<IUserService>().Received(0).DeleteManyAsync(Arg.Any<IEnumerable<User>>());
|
await sutProvider.GetDependency<IUserService>().Received(1).DeleteManyAsync(Arg.Is<IEnumerable<User>>(list => list.Count() == 2));
|
||||||
await sutProvider.GetDependency<IUserService>().Received(2).DeleteAsync(Arg.Any<User>());
|
await sutProvider.GetDependency<IUserService>().Received(0).DeleteAsync(Arg.Any<User>());
|
||||||
await sutProvider.GetDependency<IEventService>().Received(1).LogOrganizationUserEventsAsync(
|
await sutProvider.GetDependency<IEventService>().Received(1).LogOrganizationUserEventsAsync(
|
||||||
Arg.Is<IEnumerable<(OrganizationUser, EventType, DateTime?)>>(events =>
|
Arg.Is<IEnumerable<(OrganizationUser, EventType, DateTime?)>>(events =>
|
||||||
events.Count(e => e.Item1.Id == orgUser1.Id && e.Item2 == EventType.OrganizationUser_Deleted) == 1
|
events.Count(e => e.Item1.Id == orgUser1.Id && e.Item2 == EventType.OrganizationUser_Deleted) == 1
|
||||||
@ -351,10 +351,11 @@ public class DeleteManagedOrganizationUserAccountCommandTests
|
|||||||
Guid organizationId,
|
Guid organizationId,
|
||||||
Guid orgUserId)
|
Guid orgUserId)
|
||||||
{
|
{
|
||||||
// Arrang
|
// Arrange
|
||||||
sutProvider.GetDependency<IFeatureService>()
|
sutProvider.GetDependency<IFeatureService>()
|
||||||
.IsEnabled(FeatureFlagKeys.AccountDeprovisioning).Returns(false);
|
.IsEnabled(FeatureFlagKeys.AccountDeprovisioning).Returns(false);
|
||||||
|
|
||||||
|
var usersToDelete = new List<User>();
|
||||||
// Act
|
// Act
|
||||||
var result = await sutProvider.Sut.DeleteManyUsersAsync(organizationId, new[] { orgUserId }, null);
|
var result = await sutProvider.Sut.DeleteManyUsersAsync(organizationId, new[] { orgUserId }, null);
|
||||||
|
|
||||||
@ -362,7 +363,7 @@ public class DeleteManagedOrganizationUserAccountCommandTests
|
|||||||
Assert.Single(result);
|
Assert.Single(result);
|
||||||
Assert.Equal(orgUserId, result.First().Item1);
|
Assert.Equal(orgUserId, result.First().Item1);
|
||||||
Assert.Contains("Member not found.", result.First().Item2);
|
Assert.Contains("Member not found.", result.First().Item2);
|
||||||
await sutProvider.GetDependency<IUserService>().Received(0).DeleteManyAsync(Arg.Any<IEnumerable<User>>());
|
await sutProvider.GetDependency<IUserService>().Received(1).DeleteManyAsync(Arg.Is<IEnumerable<User>>(list => list.Count() == 0));
|
||||||
await sutProvider.GetDependency<IUserService>().Received(0).DeleteAsync(Arg.Any<User>());
|
await sutProvider.GetDependency<IUserService>().Received(0).DeleteAsync(Arg.Any<User>());
|
||||||
await sutProvider.GetDependency<IEventService>().Received(0)
|
await sutProvider.GetDependency<IEventService>().Received(0)
|
||||||
.LogOrganizationUserEventsAsync(Arg.Any<IEnumerable<(OrganizationUser, EventType, DateTime?)>>());
|
.LogOrganizationUserEventsAsync(Arg.Any<IEnumerable<(OrganizationUser, EventType, DateTime?)>>());
|
||||||
|
Loading…
Reference in New Issue
Block a user