mirror of
https://github.com/bitwarden/server
synced 2025-12-23 19:53:40 +00:00
[PM-25675] - fix NormalCipherPermissions.CanDelete (#6666)
* fix NormalCipherPermissions.CanDelete * fix test * fix tests
This commit is contained in:
@@ -74,7 +74,7 @@ public class NormalCipherPermissionTests
|
||||
var cipherDetails = new CipherDetails { UserId = null, OrganizationId = Guid.NewGuid() };
|
||||
|
||||
// Act
|
||||
var exception = Assert.Throws<Exception>(() => NormalCipherPermissions.CanDelete(user, cipherDetails, organizationAbility));
|
||||
var exception = Assert.Throws<Exception>(() => NormalCipherPermissions.CanRestore(user, cipherDetails, organizationAbility));
|
||||
|
||||
// Assert
|
||||
Assert.Equal("Cipher does not belong to the input organization.", exception.Message);
|
||||
@@ -92,11 +92,11 @@ public class NormalCipherPermissionTests
|
||||
// Arrange
|
||||
var user = new User { Id = Guid.Empty };
|
||||
var organizationId = Guid.NewGuid();
|
||||
var cipherDetails = new CipherDetails { Manage = manage, Edit = edit, UserId = null, OrganizationId = organizationId };
|
||||
var cipherDetails = new CipherDetails { Manage = manage, Edit = edit, UserId = user.Id, OrganizationId = organizationId };
|
||||
var organizationAbility = new OrganizationAbility { Id = organizationId, LimitItemDeletion = limitItemDeletion };
|
||||
|
||||
// Act
|
||||
var result = NormalCipherPermissions.CanRestore(user, cipherDetails, organizationAbility);
|
||||
var result = NormalCipherPermissions.CanDelete(user, cipherDetails, organizationAbility);
|
||||
|
||||
// Assert
|
||||
Assert.Equal(result, expectedResult);
|
||||
|
||||
Reference in New Issue
Block a user