From 1fd093d95d515ae613766ffcb56a870ee75232df Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Fri, 29 May 2026 09:52:47 -0400 Subject: [PATCH] test(config): global LdapGroupRoleMapping CRUD --- .../LdapGroupRoleMappingServiceTests.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/Core/ZB.MOM.WW.OtOpcUa.Configuration.Tests/LdapGroupRoleMappingServiceTests.cs b/tests/Core/ZB.MOM.WW.OtOpcUa.Configuration.Tests/LdapGroupRoleMappingServiceTests.cs index 38603365..39908756 100644 --- a/tests/Core/ZB.MOM.WW.OtOpcUa.Configuration.Tests/LdapGroupRoleMappingServiceTests.cs +++ b/tests/Core/ZB.MOM.WW.OtOpcUa.Configuration.Tests/LdapGroupRoleMappingServiceTests.cs @@ -146,4 +146,23 @@ public sealed class LdapGroupRoleMappingServiceTests : IDisposable await svc.DeleteAsync(Guid.NewGuid(), CancellationToken.None); // no exception } + + /// Verifies that a system-wide row (IsSystemWide=true, ClusterId=null) appears in both ListAllAsync and GetByGroupsAsync. + [Fact] + public async Task SystemWide_Row_AppearsIn_ListAll_And_GetByGroups() + { + var svc = new LdapGroupRoleMappingService(_db); + var saved = await svc.CreateAsync( + Make("cn=sysadmins,dc=x", AdminRole.FleetAdmin, clusterId: null, isSystemWide: true), + CancellationToken.None); + + saved.IsSystemWide.ShouldBeTrue(); + saved.ClusterId.ShouldBeNull(); + + var all = await svc.ListAllAsync(CancellationToken.None); + all.ShouldContain(r => r.Id == saved.Id); + + var byGroup = await svc.GetByGroupsAsync(["cn=sysadmins,dc=x"], CancellationToken.None); + byGroup.ShouldContain(r => r.Id == saved.Id); + } }