mirror of
https://github.com/alexhopeoconnor/dnsmasq-webui.git
synced 2026-10-03 22:12:00 +10:00
Unify the pages around the effective-config save workflow, source-aware projections, and hosts-style table UX so draft changes are easier to understand and the specialized editors stay consistent and better covered by tests.
44 lines
1.5 KiB
C#
44 lines
1.5 KiB
C#
using DnsmasqWebUI.Models.Config;
|
|
|
|
namespace DnsmasqWebUI.Tests.Models.Config;
|
|
|
|
public sealed class DnsmasqManagedPathSetTests
|
|
{
|
|
[Fact]
|
|
public void FromOptions_WithoutManagedFilesDirectory_UsesMainConfigDirectory()
|
|
{
|
|
var options = new DnsmasqOptions
|
|
{
|
|
MainConfigPath = "/etc/dnsmasq.conf",
|
|
ManagedFileName = "zz-webui.conf",
|
|
ManagedHostsFileName = "zz-webui.hosts"
|
|
};
|
|
|
|
var paths = DnsmasqManagedPathSet.FromOptions(options);
|
|
|
|
Assert.Equal("/etc/dnsmasq.conf", paths.MainConfigPath);
|
|
Assert.Equal("/etc", paths.ManagedFilesDirectory);
|
|
Assert.Equal("/etc/zz-webui.conf", paths.ManagedFilePath);
|
|
Assert.Equal("/etc/zz-webui.hosts", paths.ManagedHostsFilePath);
|
|
}
|
|
|
|
[Fact]
|
|
public void FromOptions_WithManagedFilesDirectory_UsesOverrideDirectory()
|
|
{
|
|
var options = new DnsmasqOptions
|
|
{
|
|
MainConfigPath = "/etc/dnsmasq.conf",
|
|
ManagedFilesDirectory = "/srv/repo/dnsmasq",
|
|
ManagedFileName = "zz-webui.conf",
|
|
ManagedHostsFileName = "zz-webui.hosts"
|
|
};
|
|
|
|
var paths = DnsmasqManagedPathSet.FromOptions(options);
|
|
|
|
Assert.Equal("/etc/dnsmasq.conf", paths.MainConfigPath);
|
|
Assert.Equal("/srv/repo/dnsmasq", paths.ManagedFilesDirectory);
|
|
Assert.Equal("/srv/repo/dnsmasq/zz-webui.conf", paths.ManagedFilePath);
|
|
Assert.Equal("/srv/repo/dnsmasq/zz-webui.hosts", paths.ManagedHostsFilePath);
|
|
}
|
|
}
|