mirror of
https://github.com/bitwarden/server.git
synced 2024-11-24 12:35:25 +01:00
Allow acceptable result ranges for integration tests (#3161)
This commit is contained in:
parent
ab5c6d088b
commit
ca368466ce
@ -488,9 +488,9 @@ public class IdentityServerTests : IClassFixture<IdentityApplicationFactory>
|
||||
}
|
||||
|
||||
[Theory, BitAutoData]
|
||||
public async Task TokenEndpoint_ToQuickInOneSecond_BlockRequest(string deviceId)
|
||||
public async Task TokenEndpoint_TooQuickInOneSecond_BlockRequest(string deviceId)
|
||||
{
|
||||
const int AmountInOneSecondAllowed = 5;
|
||||
const int AmountInOneSecondAllowed = 10;
|
||||
|
||||
// The rule we are testing is 10 requests in 1 second
|
||||
var username = "test+ratelimiting@email.com";
|
||||
@ -514,9 +514,9 @@ public class IdentityServerTests : IClassFixture<IdentityApplicationFactory>
|
||||
}
|
||||
|
||||
var responses = (await Task.WhenAll(tasks)).ToList();
|
||||
var blockResponses = responses.Where(c => c.Response.StatusCode == StatusCodes.Status429TooManyRequests);
|
||||
|
||||
Assert.Equal(5, responses.Count(c => c.Response.StatusCode == StatusCodes.Status200OK));
|
||||
Assert.Equal(1, responses.Count(c => c.Response.StatusCode == StatusCodes.Status429TooManyRequests));
|
||||
Assert.True(blockResponses.Count() > 0);
|
||||
|
||||
Task<HttpContext> MakeRequest()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user