From a6f4011806c83f1cb2af6834cce90b7bbedcf08e Mon Sep 17 00:00:00 2001 From: dmolinari Date: Thu, 16 Apr 2026 19:08:32 -0300 Subject: [PATCH] fix(tests): resolve ADM-001 regressions in Api.Tests fixture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update hardcoded permiso count from 21 → 22 in AuthControllerTests and PermisosEndpointTests after V011 added 'administracion:secciones:gestionar' - The TestSupport SqlTestFixture already had Medio_History/Seccion_History in TablesToIgnore; tests were failing due to stale binaries (needed rebuild) --- tests/SIGCM2.Api.Tests/Auth/AuthControllerTests.cs | 3 ++- .../Permisos/PermisosEndpointTests.cs | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/SIGCM2.Api.Tests/Auth/AuthControllerTests.cs b/tests/SIGCM2.Api.Tests/Auth/AuthControllerTests.cs index d359292..88dfc97 100644 --- a/tests/SIGCM2.Api.Tests/Auth/AuthControllerTests.cs +++ b/tests/SIGCM2.Api.Tests/Auth/AuthControllerTests.cs @@ -47,7 +47,8 @@ public class AuthControllerTests Assert.False(string.IsNullOrWhiteSpace(nombre.GetString()), "'usuario.nombre' must not be empty"); Assert.False(string.IsNullOrWhiteSpace(rol.GetString()), "'usuario.rol' must not be empty"); Assert.Equal(JsonValueKind.Array, permisos.ValueKind); - Assert.Equal(21, permisos.GetArrayLength()); + // V011 (ADM-001) adds 'administracion:secciones:gestionar' → 22 total + Assert.Equal(22, permisos.GetArrayLength()); } // Scenario: invalid credentials return 401 with opaque error diff --git a/tests/SIGCM2.Api.Tests/Permisos/PermisosEndpointTests.cs b/tests/SIGCM2.Api.Tests/Permisos/PermisosEndpointTests.cs index efdbbca..b04c080 100644 --- a/tests/SIGCM2.Api.Tests/Permisos/PermisosEndpointTests.cs +++ b/tests/SIGCM2.Api.Tests/Permisos/PermisosEndpointTests.cs @@ -130,7 +130,7 @@ public sealed class PermisosEndpointTests : IAsyncLifetime // ── GET /api/v1/permisos — catalog ─────────────────────────────────────── [Fact] - public async Task GetPermisos_WithAdmin_Returns200With21Items() + public async Task GetPermisos_WithAdmin_Returns200With22Items() { var token = await GetBearerTokenAsync(AdminUsername, AdminPassword); using var req = BuildRequest(HttpMethod.Get, "/api/v1/permisos", bearerToken: token); @@ -138,8 +138,8 @@ public sealed class PermisosEndpointTests : IAsyncLifetime Assert.Equal(HttpStatusCode.OK, resp.StatusCode); var list = await resp.Content.ReadFromJsonAsync(); - // V007 (UDT-006) adds 3 new admin permisos → 21 total - Assert.Equal(21, list.GetArrayLength()); + // V011 (ADM-001) adds 'administracion:secciones:gestionar' → 22 total + Assert.Equal(22, list.GetArrayLength()); } [Fact] @@ -182,7 +182,7 @@ public sealed class PermisosEndpointTests : IAsyncLifetime // ── GET /api/v1/roles/{codigo}/permisos ────────────────────────────────── [Fact] - public async Task GetRolPermisos_AdminRol_Returns200With21Items() + public async Task GetRolPermisos_AdminRol_Returns200With22Items() { var token = await GetBearerTokenAsync(AdminUsername, AdminPassword); using var req = BuildRequest(HttpMethod.Get, "/api/v1/roles/admin/permisos", bearerToken: token); @@ -190,8 +190,8 @@ public sealed class PermisosEndpointTests : IAsyncLifetime Assert.Equal(HttpStatusCode.OK, resp.StatusCode); var list = await resp.Content.ReadFromJsonAsync(); - // V007 (UDT-006) adds 3 new admin permisos → 21 total - Assert.Equal(21, list.GetArrayLength()); + // V011 (ADM-001) adds 'administracion:secciones:gestionar' → 22 total + Assert.Equal(22, list.GetArrayLength()); } [Fact]