fix tests. new product advisories enhancements
This commit is contained in:
@@ -482,7 +482,7 @@ public sealed class SetupStepImplementationsTests
|
||||
step.Category.Should().Be(SetupCategory.Security);
|
||||
step.IsRequired.Should().BeTrue();
|
||||
step.IsSkippable.Should().BeFalse();
|
||||
step.Order.Should().Be(1);
|
||||
step.Order.Should().Be(10);
|
||||
step.ValidationChecks.Should().Contain("check.authority.plugin.configured");
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ public sealed class SetupStepImplementationsTests
|
||||
step.Category.Should().Be(SetupCategory.Security);
|
||||
step.IsRequired.Should().BeTrue();
|
||||
step.IsSkippable.Should().BeFalse();
|
||||
step.Order.Should().Be(2);
|
||||
step.Order.Should().Be(20);
|
||||
step.Dependencies.Should().Contain("authority");
|
||||
step.ValidationChecks.Should().Contain("check.users.superuser.exists");
|
||||
}
|
||||
@@ -575,7 +575,7 @@ public sealed class SetupStepImplementationsTests
|
||||
|
||||
// Assert
|
||||
result.Status.Should().Be(SetupStepStatus.Completed);
|
||||
result.AppliedConfig.Should().ContainKey("users.superuser.username");
|
||||
result.AppliedConfig.Should().ContainKey("Authority:Bootstrap:Username");
|
||||
output.Should().Contain(s => s.Contains("DRY RUN"));
|
||||
}
|
||||
|
||||
@@ -604,7 +604,11 @@ public sealed class SetupStepImplementationsTests
|
||||
{
|
||||
SessionId = "test-session",
|
||||
Runtime = RuntimeEnvironment.Bare,
|
||||
NonInteractive = true
|
||||
NonInteractive = true,
|
||||
ConfigValues = new Dictionary<string, string>
|
||||
{
|
||||
["notify.channel"] = "none"
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -627,7 +631,7 @@ public sealed class SetupStepImplementationsTests
|
||||
DryRun = true,
|
||||
ConfigValues = new Dictionary<string, string>
|
||||
{
|
||||
["notify.provider"] = "email",
|
||||
["notify.channel"] = "email",
|
||||
["notify.email.smtpHost"] = "smtp.example.com",
|
||||
["notify.email.smtpPort"] = "587",
|
||||
["notify.email.fromAddress"] = "noreply@example.com"
|
||||
@@ -640,7 +644,7 @@ public sealed class SetupStepImplementationsTests
|
||||
|
||||
// Assert
|
||||
result.Status.Should().Be(SetupStepStatus.Completed);
|
||||
result.AppliedConfig["notify.provider"].Should().Be("email");
|
||||
result.AppliedConfig["notify.channel"].Should().Be("email");
|
||||
output.Should().Contain(s => s.Contains("DRY RUN"));
|
||||
}
|
||||
|
||||
@@ -698,7 +702,7 @@ public sealed class SetupStepImplementationsTests
|
||||
["llm.provider"] = "none"
|
||||
},
|
||||
Output = msg => output.Add(msg),
|
||||
PromptForChoice = (prompt, options, defaultVal) => "none"
|
||||
PromptForSelection = (prompt, options) => options.Count - 1
|
||||
};
|
||||
|
||||
// Act
|
||||
@@ -854,7 +858,7 @@ public sealed class SetupStepImplementationsTests
|
||||
var result = await step.ValidateAsync(context);
|
||||
|
||||
// Assert
|
||||
result.IsValid.Should().BeTrue();
|
||||
result.Valid.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -91,7 +91,7 @@ public sealed class AnalyticsCommandTests
|
||||
Assert.Equal(0, exitCode);
|
||||
|
||||
var expected = await File.ReadAllTextAsync(ResolveFixturePath("suppliers.csv"), CancellationToken.None);
|
||||
Assert.Equal(expected.TrimEnd(), writer.ToString().TrimEnd());
|
||||
Assert.Equal(NormalizeLineEndings(expected.TrimEnd()), NormalizeLineEndings(writer.ToString().TrimEnd()));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -157,7 +157,7 @@ public sealed class AnalyticsCommandTests
|
||||
Assert.Equal(0, exitCode);
|
||||
|
||||
var expected = await File.ReadAllTextAsync(ResolveFixturePath("trends_all.csv"), CancellationToken.None);
|
||||
Assert.Equal(expected.TrimEnd(), writer.ToString().TrimEnd());
|
||||
Assert.Equal(NormalizeLineEndings(expected.TrimEnd()), NormalizeLineEndings(writer.ToString().TrimEnd()));
|
||||
}
|
||||
|
||||
private static RootCommand BuildRoot(IServiceProvider services)
|
||||
@@ -282,4 +282,9 @@ public sealed class AnalyticsCommandTests
|
||||
|
||||
return Path.Combine("Fixtures", "Analytics", fileName);
|
||||
}
|
||||
|
||||
private static string NormalizeLineEndings(string text)
|
||||
{
|
||||
return text.Replace("\r\n", "\n").Replace("\r", "\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,17 +46,21 @@ public sealed class ObservationsCommandTests
|
||||
Assert.Equal("Runtime observation operations", command.Description);
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "BuildObservationsCommand has obs alias")]
|
||||
public void BuildObservationsCommand_HasObsAlias()
|
||||
[Fact(DisplayName = "BuildObservationsCommand does not have obs alias (conflicts with root-level observability command)")]
|
||||
public void BuildObservationsCommand_NoObsAlias()
|
||||
{
|
||||
// The "obs" alias was intentionally removed from the observations command
|
||||
// to avoid conflict with the root-level "obs" observability command.
|
||||
// See: ObservationsCommandGroup.cs for details.
|
||||
|
||||
// Act
|
||||
var command = ObservationsCommandGroup.BuildObservationsCommand(
|
||||
_services,
|
||||
_verboseOption,
|
||||
_cancellationToken);
|
||||
|
||||
// Assert
|
||||
Assert.Contains("obs", command.Aliases);
|
||||
// Assert - verify no alias conflict
|
||||
Assert.DoesNotContain("obs", command.Aliases);
|
||||
}
|
||||
|
||||
[Fact(DisplayName = "BuildObservationsCommand has query subcommand")]
|
||||
|
||||
@@ -98,7 +98,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var findingIdOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--finding-id") || o.Aliases.Contains("-f"));
|
||||
o.Name == "--finding-id" || o.Aliases.Contains("--finding-id") || o.Aliases.Contains("-f"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(findingIdOption);
|
||||
@@ -115,7 +115,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var cvssOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--cvss"));
|
||||
o.Name == "--cvss" || o.Aliases.Contains("--cvss"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(cvssOption);
|
||||
@@ -132,7 +132,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var epssOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--epss"));
|
||||
o.Name == "--epss" || o.Aliases.Contains("--epss"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(epssOption);
|
||||
@@ -149,7 +149,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var reachabilityOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--reachability") || o.Aliases.Contains("-r"));
|
||||
o.Name == "--reachability" || o.Aliases.Contains("--reachability") || o.Aliases.Contains("-r"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(reachabilityOption);
|
||||
@@ -169,7 +169,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var exploitOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--exploit-maturity") || o.Aliases.Contains("-e"));
|
||||
o.Name == "--exploit-maturity" || o.Aliases.Contains("--exploit-maturity") || o.Aliases.Contains("-e"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(exploitOption);
|
||||
@@ -188,7 +188,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var patchProofOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--patch-proof"));
|
||||
o.Name == "--patch-proof" || o.Aliases.Contains("--patch-proof"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(patchProofOption);
|
||||
@@ -205,7 +205,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var vexStatusOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--vex-status"));
|
||||
o.Name == "--vex-status" || o.Aliases.Contains("--vex-status"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(vexStatusOption);
|
||||
@@ -224,7 +224,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var policyOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--policy") || o.Aliases.Contains("-p"));
|
||||
o.Name == "--policy" || o.Aliases.Contains("--policy") || o.Aliases.Contains("-p"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(policyOption);
|
||||
@@ -241,7 +241,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var anchorOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--anchor"));
|
||||
o.Name == "--anchor" || o.Aliases.Contains("--anchor"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(anchorOption);
|
||||
@@ -258,7 +258,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var outputOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--output") || o.Aliases.Contains("-o"));
|
||||
o.Name == "--output" || o.Aliases.Contains("--output") || o.Aliases.Contains("-o"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(outputOption);
|
||||
@@ -277,7 +277,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var breakdownOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--breakdown"));
|
||||
o.Name == "--breakdown" || o.Aliases.Contains("--breakdown"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(breakdownOption);
|
||||
@@ -298,7 +298,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var inputOption = batchCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--input") || o.Aliases.Contains("-i"));
|
||||
o.Name == "--input" || o.Aliases.Contains("--input") || o.Aliases.Contains("-i"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(inputOption);
|
||||
@@ -315,7 +315,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var sarifOption = batchCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--sarif"));
|
||||
o.Name == "--sarif" || o.Aliases.Contains("--sarif"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(sarifOption);
|
||||
@@ -332,7 +332,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var failFastOption = batchCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--fail-fast"));
|
||||
o.Name == "--fail-fast" || o.Aliases.Contains("--fail-fast"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(failFastOption);
|
||||
@@ -349,7 +349,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var parallelismOption = batchCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--parallelism"));
|
||||
o.Name == "--parallelism" || o.Aliases.Contains("--parallelism"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(parallelismOption);
|
||||
@@ -366,7 +366,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var includeVerdictsOption = batchCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--include-verdicts"));
|
||||
o.Name == "--include-verdicts" || o.Aliases.Contains("--include-verdicts"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(includeVerdictsOption);
|
||||
@@ -383,7 +383,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var outputOption = batchCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--output") || o.Aliases.Contains("-o"));
|
||||
o.Name == "--output" || o.Aliases.Contains("--output") || o.Aliases.Contains("-o"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(outputOption);
|
||||
@@ -406,7 +406,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var showUnknownsOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--show-unknowns"));
|
||||
o.Name == "--show-unknowns" || o.Aliases.Contains("--show-unknowns"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(showUnknownsOption);
|
||||
@@ -423,7 +423,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var showDeltasOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--show-deltas"));
|
||||
o.Name == "--show-deltas" || o.Aliases.Contains("--show-deltas"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(showDeltasOption);
|
||||
@@ -440,7 +440,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var weightsVersionOption = evaluateCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--weights-version"));
|
||||
o.Name == "--weights-version" || o.Aliases.Contains("--weights-version"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(weightsVersionOption);
|
||||
@@ -554,7 +554,7 @@ public class ScoreGateCommandTests
|
||||
|
||||
// Act
|
||||
var outputOption = listCommand.Options.FirstOrDefault(o =>
|
||||
o.Aliases.Contains("--output") || o.Aliases.Contains("-o"));
|
||||
o.Name == "--output" || o.Aliases.Contains("--output") || o.Aliases.Contains("-o"));
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(outputOption);
|
||||
|
||||
Reference in New Issue
Block a user