mirror of
https://github.com/bitwarden/server.git
synced 2025-06-27 22:26:13 -05:00
Remove unused test method for handling DefaultUserCollection in CollectionsControllerTests
This commit is contained in:
parent
aa655b6024
commit
74e604347b
@ -5,7 +5,6 @@ using Bit.Api.Vault.AuthorizationHandlers.Collections;
|
|||||||
using Bit.Core.AdminConsole.Entities;
|
using Bit.Core.AdminConsole.Entities;
|
||||||
using Bit.Core.Context;
|
using Bit.Core.Context;
|
||||||
using Bit.Core.Entities;
|
using Bit.Core.Entities;
|
||||||
using Bit.Core.Enums;
|
|
||||||
using Bit.Core.Exceptions;
|
using Bit.Core.Exceptions;
|
||||||
using Bit.Core.Models.Data;
|
using Bit.Core.Models.Data;
|
||||||
using Bit.Core.OrganizationFeatures.OrganizationCollections.Interfaces;
|
using Bit.Core.OrganizationFeatures.OrganizationCollections.Interfaces;
|
||||||
@ -485,31 +484,4 @@ public class CollectionsControllerTests
|
|||||||
await sutProvider.GetDependency<IBulkAddCollectionAccessCommand>().DidNotReceiveWithAnyArgs()
|
await sutProvider.GetDependency<IBulkAddCollectionAccessCommand>().DidNotReceiveWithAnyArgs()
|
||||||
.AddAccessAsync(default, default, default);
|
.AddAccessAsync(default, default, default);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory, BitAutoData]
|
|
||||||
public async Task PutUsers_WithDefaultUserCollectionType_ThrowsBadRequest(Organization organization,
|
|
||||||
Collection collection, IEnumerable<SelectionReadOnlyRequestModel> model, SutProvider<CollectionsController> sutProvider)
|
|
||||||
{
|
|
||||||
collection.Type = CollectionType.DefaultUserCollection;
|
|
||||||
collection.OrganizationId = organization.Id;
|
|
||||||
|
|
||||||
sutProvider.GetDependency<ICollectionRepository>()
|
|
||||||
.GetByIdAsync(collection.Id)
|
|
||||||
.Returns(collection);
|
|
||||||
|
|
||||||
sutProvider.GetDependency<IAuthorizationService>()
|
|
||||||
.AuthorizeAsync(Arg.Any<ClaimsPrincipal>(),
|
|
||||||
collection,
|
|
||||||
Arg.Is<IEnumerable<IAuthorizationRequirement>>(r => r.Contains(BulkCollectionOperations.ModifyUserAccess)))
|
|
||||||
.Returns(AuthorizationResult.Success());
|
|
||||||
|
|
||||||
var exception = await Assert.ThrowsAsync<BadRequestException>(() =>
|
|
||||||
sutProvider.Sut.PutUsers(organization.Id, collection.Id, model));
|
|
||||||
|
|
||||||
Assert.Contains("You cannot modify member access for collections with the type as DefaultUserCollection.", exception.Message);
|
|
||||||
|
|
||||||
await sutProvider.GetDependency<ICollectionRepository>()
|
|
||||||
.DidNotReceiveWithAnyArgs()
|
|
||||||
.UpdateUsersAsync(default, default);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user