Files
Nitload 0ea679932e
Verify / verify (ubuntu-latest, linux-bionic-arm64) (push) Canceled after 0s
Verify / verify (ubuntu-latest, linux-x64) (push) Canceled after 0s
Verify / verify (windows-latest, win-x64) (push) Canceled after 0s
Verify / postgres (push) Canceled after 0s
Build Charac server and client with OIDC, SSH sessions, and packages
2026-10-05 14:02:50 +08:00

27 lines
996 B
C#

using Charac.Client;
namespace Charac.Server.Tests;
public sealed class ClientConfigurationTests
{
[Fact]
public void LoadsHttpsServerAndRejectsUnsafeOrAmbiguousSettings()
{
var path = Path.Combine(Path.GetTempPath(), "rac-client-config-" + Guid.NewGuid().ToString("N"));
try
{
File.WriteAllText(path, "; per-user endpoint\n[client]\nserver=\"https://access.example.com\"\n");
Assert.Equal("https://access.example.com/", ClientConfiguration.LoadServer(path));
File.WriteAllText(path, "[client]\nserver=http://access.example.com\n");
Assert.Throws<InvalidOperationException>(() => ClientConfiguration.LoadServer(path));
File.WriteAllText(path, "[client]\nserver=https://one.example\nserver=https://two.example\n");
Assert.Throws<InvalidOperationException>(() => ClientConfiguration.LoadServer(path));
}
finally
{
File.Delete(path);
}
}
}