test(config): global LdapGroupRoleMapping CRUD
This commit is contained in:
@@ -146,4 +146,23 @@ public sealed class LdapGroupRoleMappingServiceTests : IDisposable
|
|||||||
await svc.DeleteAsync(Guid.NewGuid(), CancellationToken.None);
|
await svc.DeleteAsync(Guid.NewGuid(), CancellationToken.None);
|
||||||
// no exception
|
// no exception
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Verifies that a system-wide row (IsSystemWide=true, ClusterId=null) appears in both ListAllAsync and GetByGroupsAsync.</summary>
|
||||||
|
[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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user