mirror of
https://github.com/bitwarden/server.git
synced 2025-04-04 20:50:21 -05:00
Fix tests
This commit is contained in:
parent
038e6e63b6
commit
a8b510c6a9
@ -49,7 +49,7 @@ public class OrganizationRequirementHandlerTests
|
||||
// Arrange requirement
|
||||
var testRequirement = Substitute.For<IOrganizationRequirement>();
|
||||
testRequirement
|
||||
.AuthorizeAsync(organizationId, null, Arg.Any<Func<Task<bool>>>())
|
||||
.AuthorizeAsync(null, Arg.Any<Func<Task<bool>>>())
|
||||
.ReturnsForAnyArgs(false);
|
||||
var authContext = new AuthorizationHandlerContext([testRequirement], new ClaimsPrincipal(), null);
|
||||
|
||||
@ -57,7 +57,7 @@ public class OrganizationRequirementHandlerTests
|
||||
await sutProvider.Sut.HandleAsync(authContext);
|
||||
|
||||
// Assert
|
||||
await testRequirement.Received(1).AuthorizeAsync(organizationId, null, Arg.Any<Func<Task<bool>>>());
|
||||
await testRequirement.Received(1).AuthorizeAsync(null, Arg.Any<Func<Task<bool>>>());
|
||||
Assert.False(authContext.HasSucceeded);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ public class OrganizationRequirementHandlerTests
|
||||
// Arrange requirement
|
||||
var testRequirement = Substitute.For<IOrganizationRequirement>();
|
||||
testRequirement
|
||||
.AuthorizeAsync(organizationId, null, Arg.Any<Func<Task<bool>>>())
|
||||
.AuthorizeAsync(null, Arg.Any<Func<Task<bool>>>())
|
||||
.ReturnsForAnyArgs(true);
|
||||
var authContext = new AuthorizationHandlerContext([testRequirement], new ClaimsPrincipal(), null);
|
||||
|
||||
@ -78,7 +78,7 @@ public class OrganizationRequirementHandlerTests
|
||||
await sutProvider.Sut.HandleAsync(authContext);
|
||||
|
||||
// Assert
|
||||
await testRequirement.Received(1).AuthorizeAsync(organizationId, null, Arg.Any<Func<Task<bool>>>());
|
||||
await testRequirement.Received(1).AuthorizeAsync(null, Arg.Any<Func<Task<bool>>>());
|
||||
Assert.True(authContext.HasSucceeded);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user