mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
[AC-1139] Removed unnecessary permissions object creation on unit tests
This commit is contained in:
@ -32,7 +32,6 @@ public class BulkCollectionAuthorizationHandlerTests
|
|||||||
{
|
{
|
||||||
organization.Type = userType;
|
organization.Type = userType;
|
||||||
organization.LimitCollectionCreationDeletion = true;
|
organization.LimitCollectionCreationDeletion = true;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
var context = new AuthorizationHandlerContext(
|
var context = new AuthorizationHandlerContext(
|
||||||
new[] { BulkCollectionOperations.Create },
|
new[] { BulkCollectionOperations.Create },
|
||||||
@ -142,7 +141,6 @@ public class BulkCollectionAuthorizationHandlerTests
|
|||||||
{
|
{
|
||||||
organization.Type = userType;
|
organization.Type = userType;
|
||||||
organization.LimitCollectionCreationDeletion = true;
|
organization.LimitCollectionCreationDeletion = true;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
sutProvider.GetDependency<ICurrentContext>().UserId.Returns(userId);
|
sutProvider.GetDependency<ICurrentContext>().UserId.Returns(userId);
|
||||||
sutProvider.GetDependency<ICurrentContext>().GetOrganization(organization.Id).Returns(organization);
|
sutProvider.GetDependency<ICurrentContext>().GetOrganization(organization.Id).Returns(organization);
|
||||||
@ -204,7 +202,6 @@ public class BulkCollectionAuthorizationHandlerTests
|
|||||||
|
|
||||||
organization.Type = OrganizationUserType.User;
|
organization.Type = OrganizationUserType.User;
|
||||||
organization.LimitCollectionCreationDeletion = false;
|
organization.LimitCollectionCreationDeletion = false;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
sutProvider.GetDependency<ICurrentContext>().UserId.Returns(actingUserId);
|
sutProvider.GetDependency<ICurrentContext>().UserId.Returns(actingUserId);
|
||||||
sutProvider.GetDependency<ICurrentContext>().GetOrganization(organization.Id).Returns(organization);
|
sutProvider.GetDependency<ICurrentContext>().GetOrganization(organization.Id).Returns(organization);
|
||||||
@ -287,7 +284,6 @@ public class BulkCollectionAuthorizationHandlerTests
|
|||||||
{
|
{
|
||||||
organization.Type = userType;
|
organization.Type = userType;
|
||||||
organization.LimitCollectionCreationDeletion = true;
|
organization.LimitCollectionCreationDeletion = true;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
sutProvider.GetDependency<ICurrentContext>().UserId.Returns(userId);
|
sutProvider.GetDependency<ICurrentContext>().UserId.Returns(userId);
|
||||||
sutProvider.GetDependency<ICurrentContext>().GetOrganization(organization.Id).Returns(organization);
|
sutProvider.GetDependency<ICurrentContext>().GetOrganization(organization.Id).Returns(organization);
|
||||||
@ -349,7 +345,6 @@ public class BulkCollectionAuthorizationHandlerTests
|
|||||||
|
|
||||||
organization.Type = OrganizationUserType.User;
|
organization.Type = OrganizationUserType.User;
|
||||||
organization.LimitCollectionCreationDeletion = false;
|
organization.LimitCollectionCreationDeletion = false;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
sutProvider.GetDependency<ICurrentContext>().UserId.Returns(actingUserId);
|
sutProvider.GetDependency<ICurrentContext>().UserId.Returns(actingUserId);
|
||||||
sutProvider.GetDependency<ICurrentContext>().GetOrganization(organization.Id).Returns(organization);
|
sutProvider.GetDependency<ICurrentContext>().GetOrganization(organization.Id).Returns(organization);
|
||||||
@ -430,7 +425,6 @@ public class BulkCollectionAuthorizationHandlerTests
|
|||||||
{
|
{
|
||||||
organization.Type = userType;
|
organization.Type = userType;
|
||||||
organization.LimitCollectionCreationDeletion = true;
|
organization.LimitCollectionCreationDeletion = true;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
var operationsToTest = new[]
|
var operationsToTest = new[]
|
||||||
{
|
{
|
||||||
@ -503,7 +497,6 @@ public class BulkCollectionAuthorizationHandlerTests
|
|||||||
var actingUserId = Guid.NewGuid();
|
var actingUserId = Guid.NewGuid();
|
||||||
|
|
||||||
organization.Type = OrganizationUserType.User;
|
organization.Type = OrganizationUserType.User;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
foreach (var c in collections)
|
foreach (var c in collections)
|
||||||
{
|
{
|
||||||
@ -629,7 +622,6 @@ public class BulkCollectionAuthorizationHandlerTests
|
|||||||
{
|
{
|
||||||
organization.Type = userType;
|
organization.Type = userType;
|
||||||
organization.LimitCollectionCreationDeletion = true;
|
organization.LimitCollectionCreationDeletion = true;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
var context = new AuthorizationHandlerContext(
|
var context = new AuthorizationHandlerContext(
|
||||||
new[] { BulkCollectionOperations.Delete },
|
new[] { BulkCollectionOperations.Delete },
|
||||||
@ -681,7 +673,6 @@ public class BulkCollectionAuthorizationHandlerTests
|
|||||||
var actingUserId = Guid.NewGuid();
|
var actingUserId = Guid.NewGuid();
|
||||||
|
|
||||||
organization.Type = OrganizationUserType.User;
|
organization.Type = OrganizationUserType.User;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
sutProvider.GetDependency<ICurrentContext>().UserId.Returns(actingUserId);
|
sutProvider.GetDependency<ICurrentContext>().UserId.Returns(actingUserId);
|
||||||
sutProvider.GetDependency<ICurrentContext>().GetOrganization(organization.Id).Returns(organization);
|
sutProvider.GetDependency<ICurrentContext>().GetOrganization(organization.Id).Returns(organization);
|
||||||
|
@ -26,7 +26,6 @@ public class CollectionAuthorizationHandlerTests
|
|||||||
CurrentContextOrganization organization)
|
CurrentContextOrganization organization)
|
||||||
{
|
{
|
||||||
organization.Type = userType;
|
organization.Type = userType;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
var context = new AuthorizationHandlerContext(
|
var context = new AuthorizationHandlerContext(
|
||||||
new[] { CollectionOperations.ReadAll(organization.Id) },
|
new[] { CollectionOperations.ReadAll(organization.Id) },
|
||||||
@ -47,7 +46,6 @@ public class CollectionAuthorizationHandlerTests
|
|||||||
SutProvider<CollectionAuthorizationHandler> sutProvider, CurrentContextOrganization organization)
|
SutProvider<CollectionAuthorizationHandler> sutProvider, CurrentContextOrganization organization)
|
||||||
{
|
{
|
||||||
organization.Type = OrganizationUserType.User;
|
organization.Type = OrganizationUserType.User;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
var context = new AuthorizationHandlerContext(
|
var context = new AuthorizationHandlerContext(
|
||||||
new[] { CollectionOperations.ReadAll(organization.Id) },
|
new[] { CollectionOperations.ReadAll(organization.Id) },
|
||||||
@ -138,7 +136,6 @@ public class CollectionAuthorizationHandlerTests
|
|||||||
CurrentContextOrganization organization)
|
CurrentContextOrganization organization)
|
||||||
{
|
{
|
||||||
organization.Type = userType;
|
organization.Type = userType;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
var context = new AuthorizationHandlerContext(
|
var context = new AuthorizationHandlerContext(
|
||||||
new[] { CollectionOperations.ReadAllWithAccess(organization.Id) },
|
new[] { CollectionOperations.ReadAllWithAccess(organization.Id) },
|
||||||
@ -159,7 +156,6 @@ public class CollectionAuthorizationHandlerTests
|
|||||||
SutProvider<CollectionAuthorizationHandler> sutProvider, CurrentContextOrganization organization)
|
SutProvider<CollectionAuthorizationHandler> sutProvider, CurrentContextOrganization organization)
|
||||||
{
|
{
|
||||||
organization.Type = OrganizationUserType.User;
|
organization.Type = OrganizationUserType.User;
|
||||||
organization.Permissions = new Permissions();
|
|
||||||
|
|
||||||
var context = new AuthorizationHandlerContext(
|
var context = new AuthorizationHandlerContext(
|
||||||
new[] { CollectionOperations.ReadAllWithAccess(organization.Id) },
|
new[] { CollectionOperations.ReadAllWithAccess(organization.Id) },
|
||||||
|
Reference in New Issue
Block a user