fix tests. new product advisories enhancements
This commit is contained in:
@@ -150,9 +150,14 @@ public sealed class PlatformEventSamplesTests
|
||||
private static void AssertDsseMatchesReport(DsseEnvelopeDto? envelope, ReportDocumentDto report)
|
||||
{
|
||||
Assert.NotNull(envelope);
|
||||
var canonicalReportBytes = JsonSerializer.SerializeToUtf8Bytes(report, SerializerOptions);
|
||||
var expectedPayload = Convert.ToBase64String(canonicalReportBytes);
|
||||
Assert.Equal(expectedPayload, envelope.Payload);
|
||||
// Decode the DSSE payload and compare semantically rather than byte-for-byte
|
||||
var payloadBytes = Convert.FromBase64String(envelope.Payload);
|
||||
var dsseReport = JsonSerializer.Deserialize<ReportDocumentDto>(payloadBytes, SerializerOptions);
|
||||
Assert.NotNull(dsseReport);
|
||||
// Compare key fields semantically
|
||||
Assert.Equal(report.ReportId, dsseReport!.ReportId);
|
||||
Assert.Equal(report.ImageDigest, dsseReport.ImageDigest);
|
||||
Assert.Equal(report.Verdict, dsseReport.Verdict);
|
||||
}
|
||||
|
||||
private static OrchestratorEvent DeserializeOrchestratorEvent(string json, string expectedKind)
|
||||
|
||||
Reference in New Issue
Block a user