Public Access
Cover the mixed-keychain regroup refusal headlessly
The two-keychain branch of VaultViewModel.RegroupChosenHosts had no test: 7.6a's manual walk was the only thing asserting that a mixed set gets the sentence instead of the picker. A ShellFlowTests case now ticks a host in each of two vaults, reads the refusal off the status line, and shows the same command opening the picker once the set is one keychain's again. Check 7.6a cites the test and keeps only the popup wiring for the eye.
This commit is contained in:
@@ -5845,6 +5845,60 @@ public sealed class ShellFlowTests : IAsyncLifetime
|
||||
Host(vault, "staging").Host.GroupId.ShouldBeNull("it was never ticked");
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// The other refusal at the same door, and the one that needs two keychains to raise: a group is an
|
||||
/// item of one vault, so filing a mixed set under it would leave everyone else in the shared vault
|
||||
/// seeing a machine filed under nothing. Checked when the picker is asked for and over the whole set —
|
||||
/// see <see cref="VaultViewModel.RegroupChosenHosts"/> — rather than once per host mid-write, which is
|
||||
/// why no panel opens at all and the status line's sentence has to carry the whole explanation.
|
||||
/// </remarks>
|
||||
[Fact]
|
||||
public async Task RegroupingHostsChosenAcrossTwoKeychains_IsRefusedBeforeThePickerOpens()
|
||||
{
|
||||
await UnlockedAsync();
|
||||
|
||||
var vaults = shell.Vaults;
|
||||
|
||||
await vaults.LoadAsync(Token);
|
||||
|
||||
vaults.NewVaultCommand.Execute(null);
|
||||
vaults.NewVaultName = "Platform secrets";
|
||||
|
||||
await vaults.CreateVaultCommand.ExecuteAsync(null);
|
||||
|
||||
var vault = shell.Vault!;
|
||||
var sharedVaultId = vaults.SelectedVault!.VaultId;
|
||||
|
||||
await vault.LoadAsync(Token);
|
||||
|
||||
await AddHostAsync(vault, "prod-db");
|
||||
|
||||
vault.NewHostCommand.Execute(null);
|
||||
vault.EditorSelectedVault =
|
||||
vault.EditorVaultChoices.Single(choice => choice.VaultId == sharedVaultId);
|
||||
vault.EditorLabel = "prod-web";
|
||||
vault.EditorHostname = "web.internal";
|
||||
|
||||
await vault.SaveHostCommand.ExecuteAsync(null);
|
||||
|
||||
vault.ChooseHostCommand.Execute(Host(vault, "prod-db"));
|
||||
vault.ToggleHostChoiceCommand.Execute(Host(vault, "prod-web"));
|
||||
|
||||
vault.RegroupChosenHostsCommand.Execute(null);
|
||||
|
||||
vault.IsRegroupingChosenHosts.ShouldBeFalse("a group belongs to one keychain");
|
||||
vault.Status.ShouldStartWith("These hosts are in more than one keychain");
|
||||
vault.IsChoosingHosts.ShouldBeTrue("the set was refused, not dissolved");
|
||||
|
||||
// Unticking the visitor is all it takes: the refusal is about the set, not a latch the screen has
|
||||
// to be talked out of.
|
||||
vault.ToggleHostChoiceCommand.Execute(Host(vault, "prod-web"));
|
||||
|
||||
vault.RegroupChosenHostsCommand.Execute(null);
|
||||
|
||||
vault.IsRegroupingChosenHosts.ShouldBeTrue(vault.Status);
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// Duplicating keeps the group and the tags, which is the whole difference between it and a copy into
|
||||
/// another vault: the copy stays in the same keychain, so everything it points at is still there.
|
||||
|
||||
Reference in New Issue
Block a user