mirror of
https://github.com/bitwarden/server
synced 2026-01-19 08:53:57 +00:00
Fix tests
This commit is contained in:
@@ -18,11 +18,11 @@ public class QueryController(ILogger<QueryController> logger, IQueryService quer
|
||||
|
||||
return Json(result);
|
||||
}
|
||||
catch (SceneNotFoundException ex)
|
||||
catch (QueryNotFoundException ex)
|
||||
{
|
||||
return NotFound(new { Error = ex.Message });
|
||||
}
|
||||
catch (SceneExecutionException ex)
|
||||
catch (QueryExecutionException ex)
|
||||
{
|
||||
logger.LogError(ex, "Error executing query: {Query}", request.Template);
|
||||
return BadRequest(new { Error = ex.Message, Details = ex.InnerException?.Message });
|
||||
|
||||
@@ -21,6 +21,7 @@ builder.Services.AddScoped<Microsoft.AspNetCore.Identity.IPasswordHasher<Bit.Cor
|
||||
builder.Services.AddSingleton<Bit.RustSDK.RustSdkService>();
|
||||
builder.Services.AddScoped<Bit.Seeder.Factories.UserSeeder>();
|
||||
builder.Services.AddScoped<ISceneService, SceneService>();
|
||||
builder.Services.AddScoped<IQueryService, QueryService>();
|
||||
builder.Services.AddScoped<MangleId>(_ => new MangleId());
|
||||
builder.Services.AddScenes();
|
||||
builder.Services.AddQueries();
|
||||
@@ -41,3 +42,6 @@ app.UseRouting();
|
||||
app.MapControllerRoute(name: "default", pattern: "{controller=Seed}/{action=Index}/{id?}");
|
||||
|
||||
app.Run();
|
||||
|
||||
// Make Program class accessible for integration tests
|
||||
public partial class Program { }
|
||||
|
||||
@@ -43,12 +43,13 @@ public class SceneService(
|
||||
var userIds = playData.Select(pd => pd.UserId).Distinct().ToList();
|
||||
var organizationIds = playData.Select(pd => pd.OrganizationId).Distinct().ToList();
|
||||
|
||||
// Delete Users before Oraganizations to respect foreign key constraints
|
||||
// Delete Users before Organizations to respect foreign key constraints
|
||||
if (userIds.Count > 0)
|
||||
{
|
||||
var users = databaseContext.Users.Where(u => userIds.Contains(u.Id));
|
||||
await userRepository.DeleteManyAsync(users);
|
||||
}
|
||||
|
||||
if (organizationIds.Count > 0)
|
||||
{
|
||||
var organizations = databaseContext.Organizations.Where(o => organizationIds.Contains(o.Id));
|
||||
|
||||
Reference in New Issue
Block a user