Add tests for custom admin path behaviour

This commit is contained in:
Peter Benko
2026-07-06 18:27:21 +02:00
parent 1ab6ca5531
commit 0933a120bc
2 changed files with 21 additions and 1 deletions
@@ -8,7 +8,7 @@ namespace WireMock.Owin;
internal sealed class AdminPaths(string? adminPath) : IAdminPaths
{
private const string DefaultAdminPathPrefix = "/__admin";
private readonly string _prefix = adminPath ?? DefaultAdminPathPrefix;
public string Files => $"{_prefix}/files";
@@ -648,4 +648,24 @@ public class WireMockServerAdminTests(ITestOutputHelper output, ITestContextAcce
// Assert
settings.Should().NotBeNull();
}
[Fact]
public async Task WireMockServer_WithCustomAdminPath_AdminRequestsNotInLogEntries()
{
// Arrange
var cancellationToken = TestContext.Current.CancellationToken;
using var server = WireMockServer.Start(w =>
{
w.Logger = new TestOutputHelperWireMockLogger(output);
w.StartAdminInterface = true;
w.AdminPath = "/custom/__admin";
});
var client = server.CreateClient();
// Act
await client.GetAsync($"{server.Url}/custom/__admin/settings", cancellationToken);
// Assert
server.LogEntries.Should().BeEmpty();
}
}