43 lines
1.4 KiB
C#
43 lines
1.4 KiB
C#
using dy.net.model.entity;
|
|
using dy.net.storage;
|
|
|
|
namespace dy.net.Tests;
|
|
|
|
public class StorageConfigurationFingerprintTests
|
|
{
|
|
[Fact]
|
|
public void Create_TracksTargetButIgnoresCredentialCiphertextRotation()
|
|
{
|
|
var settings = Settings();
|
|
var original = StorageConfigurationFingerprint.Create(settings);
|
|
|
|
settings.ProtectedPassword = "new-randomized-ciphertext";
|
|
settings.AllowInvalidCertificate = true;
|
|
|
|
Assert.Equal(original, StorageConfigurationFingerprint.Create(settings));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("https://example.test/other-dav", "/media", "account")]
|
|
[InlineData("https://example.test/dav", "/other-media", "account")]
|
|
[InlineData("https://example.test/dav", "/media", "other-account")]
|
|
public void Create_ChangesWhenRemoteTargetChanges(string endpoint, string basePath, string userName)
|
|
{
|
|
var original = StorageConfigurationFingerprint.Create(Settings());
|
|
var changed = Settings();
|
|
changed.Endpoint = endpoint;
|
|
changed.BasePath = basePath;
|
|
changed.UserName = userName;
|
|
|
|
Assert.NotEqual(original, StorageConfigurationFingerprint.Create(changed));
|
|
}
|
|
|
|
private static WebDavSettings Settings() => new()
|
|
{
|
|
Endpoint = "https://example.test/dav/",
|
|
BasePath = "/media/",
|
|
UserName = "account",
|
|
ProtectedPassword = "ciphertext"
|
|
};
|
|
}
|