mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-06 17:09:41 +00:00
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-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 / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
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 }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
63 lines
3.0 KiB
C#
63 lines
3.0 KiB
C#
using AIStudio.Settings;
|
|
using AIStudio.Settings.DataModel;
|
|
using AIStudio.Tools.ToolCallingSystem.ToolCallingImplementations.Mailboxes;
|
|
|
|
namespace AIStudio.Tests.Settings;
|
|
|
|
/// <summary>
|
|
/// Checks how the least strict outbound data restriction an organization allows applies to the mailboxes.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// An organization may rule out the less strict levels for all mailboxes. A mailbox which still
|
|
/// holds one of them must not open a way out for its mails, and its dialog must not offer one again.
|
|
/// A mailbox which is stricter on its own must stay so.
|
|
/// </remarks>
|
|
[TestFixture]
|
|
public sealed class MailboxOutboundDataRestrictionTests
|
|
{
|
|
private static readonly DataSourceMailbox OPEN = new()
|
|
{
|
|
Id = "5d2a8f1c-6e3b-4c7d-9a0e-1b4f2c8d6e39",
|
|
Name = "Open",
|
|
OutboundDataRestriction = OutboundDataRestriction.UNRESTRICTED,
|
|
};
|
|
|
|
private static readonly DataSourceMailbox CLOSED = new()
|
|
{
|
|
Id = "8b1e4c7a-2f5d-4a9b-b3c6-7d0e9f2a1c58",
|
|
Name = "Closed",
|
|
OutboundDataRestriction = OutboundDataRestriction.ONLY_CONFIGURED_SERVICES,
|
|
};
|
|
|
|
[Test]
|
|
public void WithoutAnOrganizationTheUserDecides() => Assert.That(new DataMailboxes().MinimumOutboundDataRestriction, Is.EqualTo(OutboundDataRestriction.UNRESTRICTED));
|
|
|
|
[Test]
|
|
public void TheMinimumTightensALooserMailbox()
|
|
{
|
|
var (_, outboundData) = MailToolResults.GetRequirements([OPEN], OutboundDataRestriction.ONLY_LINKS_FROM_CHAT);
|
|
|
|
Assert.That(outboundData, Is.EqualTo(new OutboundDataRequirement(OutboundDataRestriction.ONLY_LINKS_FROM_CHAT, OPEN.Id)), "The chat names the mailbox whose mails it read, even though the level comes from the organization.");
|
|
}
|
|
|
|
[Test]
|
|
public void TheMinimumNeverLoosensAStricterMailbox()
|
|
{
|
|
var (_, outboundData) = MailToolResults.GetRequirements([CLOSED], OutboundDataRestriction.ONLY_LINKS_FROM_CHAT);
|
|
|
|
Assert.That(outboundData.Restriction, Is.EqualTo(OutboundDataRestriction.ONLY_CONFIGURED_SERVICES));
|
|
}
|
|
|
|
[Test]
|
|
public void TheDialogOffersOnlyTheLevelsAllowed()
|
|
{
|
|
Assert.Multiple(() =>
|
|
{
|
|
Assert.That(GetOfferedLevels(OutboundDataRestriction.UNRESTRICTED), Is.EqualTo(new[] { OutboundDataRestriction.ONLY_CONFIGURED_SERVICES, OutboundDataRestriction.ONLY_LINKS_FROM_CHAT, OutboundDataRestriction.UNRESTRICTED }));
|
|
Assert.That(GetOfferedLevels(OutboundDataRestriction.ONLY_LINKS_FROM_CHAT), Is.EqualTo(new[] { OutboundDataRestriction.ONLY_CONFIGURED_SERVICES, OutboundDataRestriction.ONLY_LINKS_FROM_CHAT }));
|
|
Assert.That(GetOfferedLevels(OutboundDataRestriction.ONLY_CONFIGURED_SERVICES), Is.EqualTo(new[] { OutboundDataRestriction.ONLY_CONFIGURED_SERVICES }));
|
|
});
|
|
}
|
|
|
|
private static IEnumerable<OutboundDataRestriction> GetOfferedLevels(OutboundDataRestriction minimumRestriction) => ConfigurationSelectDataFactory.GetOutboundDataRestrictionData(minimumRestriction).Select(option => option.Value);
|
|
} |