mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 09:57:59 +00:00
Added mailboxes as local data sources (#1022)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
This commit is contained in:
1 parent
93be539e50
commit
c4400c0ff6
343 files changed
+26051
-3122
No files matched your search
@@ -0,0 +1,61 @@
|
||||
using AIStudio.Settings;
|
||||
using AIStudio.Settings.DataModel;
|
||||
using AIStudio.Tools.Validation;
|
||||
|
||||
namespace AIStudio.Tests.Tools.Validation;
|
||||
|
||||
/// <summary>
|
||||
/// Checks what the mailbox dialog accepts before it lets the user test a connection or save.
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public sealed class MailboxValidationTests
|
||||
{
|
||||
private static readonly DataSourceValidation VALIDATION = new();
|
||||
|
||||
[TestCase("imap.example.org", ExpectedResult = true)]
|
||||
[TestCase(" imap.example.org ", ExpectedResult = true)]
|
||||
[TestCase("posteo.de", ExpectedResult = true)]
|
||||
[TestCase("192.168.1.20", ExpectedResult = true)]
|
||||
[TestCase("::1", ExpectedResult = true)]
|
||||
[TestCase("", ExpectedResult = false)]
|
||||
[TestCase(" ", ExpectedResult = false)]
|
||||
[TestCase("imaps://imap.example.org", ExpectedResult = false)]
|
||||
[TestCase("imap.example.org:993", ExpectedResult = false)]
|
||||
[TestCase("imap.example.org/INBOX", ExpectedResult = false)]
|
||||
public bool TheHostStandsAlone(string host) => DataSourceValidation.ValidateMailboxHost(host) is null;
|
||||
|
||||
[Test]
|
||||
public void AnUnknownEncryptionIsRejectedAndNeverOffered()
|
||||
{
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(DataSourceValidation.ValidateMailboxTransportSecurity(MailboxTransportSecurity.UNKNOWN), Is.Not.Null);
|
||||
Assert.That(ConfigurationSelectDataFactory.GetMailboxTransportSecurityData().Select(option => option.Value), Is.EqualTo(new[] { MailboxTransportSecurity.SSL_ON_CONNECT, MailboxTransportSecurity.STARTTLS }));
|
||||
});
|
||||
}
|
||||
|
||||
[TestCase(MailboxTransportSecurity.SSL_ON_CONNECT, ExpectedResult = 993)]
|
||||
[TestCase(MailboxTransportSecurity.STARTTLS, ExpectedResult = 143)]
|
||||
[TestCase(MailboxTransportSecurity.UNKNOWN, ExpectedResult = null)]
|
||||
public int? EachEncryptionComesWithItsUsualPort(MailboxTransportSecurity transportSecurity) => transportSecurity.GetUsualPort();
|
||||
|
||||
[TestCase(0, ExpectedResult = false)]
|
||||
[TestCase(DataSourceValidation.MIN_ATTACHMENT_SIZE_MEGABYTES, ExpectedResult = true)]
|
||||
[TestCase(DataSourceValidation.MAX_ATTACHMENT_SIZE_MEGABYTES, ExpectedResult = true)]
|
||||
[TestCase(DataSourceValidation.MAX_ATTACHMENT_SIZE_MEGABYTES + 1, ExpectedResult = false)]
|
||||
public bool TheAttachmentSizeStaysInItsRange(int megabytes) => DataSourceValidation.ValidateMailboxMaxAttachmentSize(megabytes) is null;
|
||||
|
||||
[Test]
|
||||
public void APasswordIsRequiredAndAStorageIssueComesFirst()
|
||||
{
|
||||
const string STORAGE_ISSUE = "The keyring is locked.";
|
||||
var validationWithIssue = new DataSourceValidation { GetSecretStorageIssue = () => STORAGE_ISSUE };
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(VALIDATION.ValidateMailboxPassword(string.Empty), Is.Not.Null, "An empty password was accepted.");
|
||||
Assert.That(VALIDATION.ValidateMailboxPassword(" secret with spaces "), Is.Null, "A password was trimmed or rejected for its spaces.");
|
||||
Assert.That(validationWithIssue.ValidateMailboxPassword("secret"), Is.EqualTo(STORAGE_ISSUE), "The issue of the keyring was not shown.");
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user