mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[SM-153] Add scaffolded API integration test project (#2209)
This commit is contained in:
@ -35,13 +35,18 @@ namespace Bit.IntegrationTestCommon.Factories
|
||||
{
|
||||
builder.ConfigureAppConfiguration(c =>
|
||||
{
|
||||
c.SetBasePath(AppContext.BaseDirectory)
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddJsonFile("appsettings.Development.json");
|
||||
|
||||
c.AddUserSecrets(typeof(Identity.Startup).Assembly, optional: true);
|
||||
c.AddInMemoryCollection(new Dictionary<string, string>
|
||||
{
|
||||
// Manually insert a EF provider so that ConfigureServices will add EF repositories but we will override
|
||||
// DbContextOptions to use an in memory database
|
||||
{ "globalSettings:databaseProvider", "postgres" },
|
||||
{ "globalSettings:postgreSql:connectionString", "Host=localhost;Username=test;Password=test;Database=test" },
|
||||
|
||||
|
||||
// Clear the redis connection string for distributed caching, forcing an in-memory implementation
|
||||
{ "globalSettings:redis:connectionString", ""}
|
||||
});
|
||||
@ -82,7 +87,7 @@ namespace Bit.IntegrationTestCommon.Factories
|
||||
services.AddSingleton<IEventRepository, EventRepository>();
|
||||
|
||||
// Our Rate limiter works so well that it begins to fail tests unless we carve out
|
||||
// one whitelisted ip. We should still test the rate limiter though and they should change the Ip
|
||||
// one whitelisted ip. We should still test the rate limiter though and they should change the Ip
|
||||
// to something that is NOT whitelisted
|
||||
services.Configure<IpRateLimitOptions>(options =>
|
||||
{
|
||||
@ -91,6 +96,9 @@ namespace Bit.IntegrationTestCommon.Factories
|
||||
FactoryConstants.WhitelistedIp,
|
||||
};
|
||||
});
|
||||
|
||||
// Fix IP Rate Limiting
|
||||
services.AddSingleton<IStartupFilter, CustomStartupFilter>();
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user