CI / Check (push) Skipped
CI / Agent integration (push) Skipped
CI / Detect Changes (push) Successful in 4s
CI / Deploy Docs (push) Skipped
CI / Deploy MCP (push) Successful in 5m5s
CI / Deploy Dashboard (push) Successful in 6m59s
CI / Deploy Agent (push) Successful in 8m56s
38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
//! The SBOM a supplier workspace releases to a customer workspace (#1028):
|
|
//! valid against CycloneDX 1.6.
|
|
|
|
#![allow(clippy::expect_used, clippy::unwrap_used)]
|
|
|
|
mod common;
|
|
|
|
use compliance_core::models::{ComponentHash, SbomEntry};
|
|
use compliance_core::sbom_docs::{self, ReleasedProduct};
|
|
|
|
#[test]
|
|
fn a_released_sbom_is_valid_cyclonedx() {
|
|
let mut sdk = SbomEntry::new("t".into(), "pump-sdk".into(), "4.2".into(), "nuget".into());
|
|
sdk.purl = Some("pkg:nuget/pump-sdk@4.2".into());
|
|
sdk.license = Some("MIT".into());
|
|
sdk.hashes = vec![ComponentHash {
|
|
alg: "SHA-256".into(),
|
|
content: "ab".repeat(32),
|
|
}];
|
|
// No purl: listed by its name and version.
|
|
let blob = SbomEntry::new(
|
|
"t".into(),
|
|
"vendor-blob".into(),
|
|
"7".into(),
|
|
"supplier".into(),
|
|
);
|
|
let product = ReleasedProduct {
|
|
name: "DR-4 Firmware",
|
|
version: "1.4.0",
|
|
supplier: "Test Antriebstechnik",
|
|
};
|
|
|
|
let doc = sbom_docs::released_cyclonedx(&[sdk, blob], &product);
|
|
|
|
assert_eq!(common::cyclonedx_errors(&doc), Vec::<String>::new());
|
|
assert_eq!(doc["components"].as_array().unwrap().len(), 2);
|
|
}
|