mod common; use guac::client::intrinsic::has_sbom::{HasSBOMIncludesInputSpec, HasSBOMInputSpec}; use guac::client::GuacClient; use packageurl::PackageUrl; use std::str::FromStr; use crate::common::guac_url; #[tokio::test] async fn has_sbom() -> Result<(), anyhow::Error> { let client = GuacClient::new(&guac_url()); let pkg = PackageUrl::from_str("pkg:rpm/trustification-has-sbom@0.3.0")?; let package_ids = client.intrinsic().ingest_package(&pkg.clone().into()).await?; client .intrinsic() .ingest_has_sbom( &pkg.clone().into(), &HasSBOMInputSpec { uri: "test-uri".to_string(), algorithm: "test-algo".to_string(), digest: "8675309".to_string(), download_location: "http://example.com/test-sbom".to_string(), origin: "test-origin".to_string(), collector: "test-collector".to_string(), known_since: Default::default(), document_ref: "test-document-ref".to_string(), }, &HasSBOMIncludesInputSpec { packages: vec![package_ids.package_version_id], artifacts: vec![], dependencies: vec![], occurrences: vec![], }, ) .await?; let result = client.intrinsic().has_sbom(&pkg.into()).await?; assert_eq!(1, result.len()); assert_eq!("8675309", result[0].digest); Ok(()) }